Install yeoman with latest nodejs 1.10.15
Asked Answered
E

3

9

migrating my system from Ubuntu 13.04 to 13.10, I've installed latest nodejs package available from the Ubuntu Logiteque (that's the frech name of the automatic package installer, don't know if it's the same in english ...).

trying to install yeoman with the command :

npm install -g yo

gives me the following error :

 npm http 200 https://registry.npmjs.org/is/-/is-0.2.7.tgz
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js

> [email protected] postinstall /usr/local/lib/node_modules/yo
> node ./scripts/doctor

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] postinstall: `node ./scripts/doctor`
npm ERR! `sh "-c" "node ./scripts/doctor"` failed with 127
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./scripts/doctor
npm ERR! You can get their info via:
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-15-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /var/www
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/npm-debug.log
npm ERR! not ok code 0

Looking at /usr/share/doc/nodejs/README.Debian :

The upstream name for the Node.js interpreter command is "node".
In Debian the interpreter command has been changed to "nodejs".

This was done to prevent a namespace collision: other commands use
the same name in their upstreams, such as ax25-node from the "node"
package.

Scripts calling Node.js as a shell command must be changed to instead
use the "nodejs" command.

So my conclusion is in order to work with nodejs 1.10.15, the yeoman script should change its call to "node" to "nodejs"

As I don't know how to change it, I'd like to know : 1. is there another yeoman script to work with nodejs 1.10.15 2. If I downgrade my nodejs version, will the install script work (if so, how can I install a downgrade version of nodejs)

Thanks for your ideas !

PARTIALLY RESOLVED :

ln -sf /usr/bin/nodejs /usr/bin/node

make the install script works but don't know if that solution is clean ...

Errantry answered 10/1, 2014 at 10:18 Comment(2)
possible duplicate of nodejs vs node on ubuntu 12.04Barbwire
Possible duplicate of npm install -g yo command gives -> ERR! [email protected] postinstall: 'node scripts/doctor.js'Boxwood
G
16

To solve this problem you need to install the package nodejs-legacy.

sudo apt-get install nodejs-legacy
Gabriella answered 5/6, 2014 at 19:22 Comment(1)
Worked for me as well!Sigrid
B
1

I believe this is similar enough to another issue that the solution I've posted there may be of use. Specifically, npm install -g yo command gives -> ERR! [email protected] postinstall: 'node scripts/doctor.js'.

Basically, clone the Yeoman repo and edit the package.json to remove the post install call to doctor.js. Hardly an ideal solution but it worked for me.. see my answer in the other thread for details.

Boxwood answered 10/2, 2014 at 2:8 Comment(0)
E
0

Check if you got correct language and encoding. In my setup, I first had to install nodejs-legacy and had to additionally change LC_ALL to:

export LC_ALL=en_US.utf8
Eliseoelish answered 6/4, 2016 at 8:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.