asdf-nodejs icon indicating copy to clipboard operation
asdf-nodejs copied to clipboard

Unknown command: node

Open delucca opened this issue 4 years ago • 9 comments

Hi!

I'm trying to install an Atom package, but it seems that asdf is preventing me to do so.

Here is the output:

business@budproj on  feature/get-key-result via ⬢ v15.0.0
❯ apm install atom-ide-javascript
Installing atom-ide-javascript to /home/odelucca/.atom/packages ✗

> [email protected] postinstall /tmp/apm-install-dir-20201017-744050-z34np5.3maj9/node_modules/atom-ide-javascript/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN lifecycle The node binary used for scripts is /home/odelucca/.asdf/shims/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
unknown command: node. Perhaps you have to reshim?
npm WARN enoent ENOENT: no such file or directory, open '/tmp/apm-install-dir-20201017-744050-z34np5.3maj9/package.json'
npm WARN apm-install-dir-20201017-744050-z34np5.3maj9 No description
npm WARN apm-install-dir-20201017-744050-z34np5.3maj9 No repository field.
npm WARN apm-install-dir-20201017-744050-z34np5.3maj9 No README data
npm WARN apm-install-dir-20201017-744050-z34np5.3maj9 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/odelucca/.atom/.apm/_logs/2020-11-18T01_16_51_669Z-debug.log

As you can see, it can't find Node command. I've already tried to reshim, but the issue persists.

Here is the output of which:

business@budproj on  feature/get-key-result via ⬢ v15.0.0 took 22s
❯ which node
/home/odelucca/.asdf/shims/node

delucca avatar Nov 18 '20 01:11 delucca

Well, I saw many issues related to this, with the same problem, and no commentaries or answers.

Since it seems this package is dead, I'm moving to nvm

delucca avatar Nov 18 '20 12:11 delucca

Project is not dead. Did you try running asdf reshim?

Stratus3D avatar Nov 20 '20 16:11 Stratus3D

Yes, I've already tried to do that.

I suggest you install Atom e try to install the plugin to check the error

delucca avatar Nov 20 '20 17:11 delucca

Related: #164.

Stratus3D avatar Nov 20 '20 17:11 Stratus3D

Yep

It seems that Atom install some packages globally while installing those plugins. Them, even if we already have those packages in my computer (I've tried to install core-js globally and reshim before installing the plugin too) asdf asks to reshim.

delucca avatar Nov 20 '20 18:11 delucca

Hello @delucca, are you still having the same problem? If so, could you please share which system are you using and how did you installed atom on it?

augustobmoura avatar Mar 11 '22 16:03 augustobmoura

I encountered this when doing pm2 startup. pm2 guided me the following, but it didn't work.

> sudo env PATH=$PATH:/home/ubuntu/.asdf/installs/nodejs/17.1.0/bin /home/ubuntu/.npm/_npx/5f7878ce38f1eb13/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
unknown command: node. Perhaps you have to reshim?

After replacing the above with the below, it worked.

> sudo sh -c 'PATH=$PATH:/home/ubuntu/.asdf/installs/nodejs/17.1.0/bin /home/ubuntu/.npm/_npx/5f7878ce38f1eb13/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu'
... success

I suspect there's some issue with environment forwarding.

jeiea avatar Mar 21 '22 16:03 jeiea

Eu encontrei isso ao fazer o pm2 startup. pm2 me guiou o seguinte, mas não funcionou.

> sudo env PATH=$PATH:/home/ubuntu/.asdf/installs/nodejs/17.1.0/bin /home/ubuntu/.npm/_npx/5f7878ce38f1eb13/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
unknown command: node. Perhaps you have to reshim?

Depois de substituir o acima pelo abaixo, funcionou.

> sudo sh -c 'PATH=$PATH:/home/ubuntu/.asdf/installs/nodejs/17.1.0/bin /home/ubuntu/.npm/_npx/5f7878ce38f1eb13/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu'
... success

Eu suspeito que há algum problema com o encaminhamento de ambiente.

Solved 👏👏👏👏 Thanks 🤝

FredHorizon avatar Apr 29 '22 20:04 FredHorizon

Hello @delucca, are you still having the same problem? If so, could you please share which system are you using and how did you installed atom on it?

TBH it took so long to solve this that I moved to a different version manage 😢

In any case, it seems that other users were able to solve that, right? So, I think you could close the issue.

delucca avatar May 02 '22 15:05 delucca

As we reached Atom's EOL, I will be closing this issue as part of greenkeeping the issues. The problem is more related to how asdf works, by creating shims as opposed to other version managers that setup the PATH environment variable. I will do the same for #164

augustobmoura avatar May 20 '23 17:05 augustobmoura