0
votes

I am unable to install yo from npm I have found these errors while running installation of yo, I have made all the paths for environment variables, but still getting error, i have also cleared the cache and re-install the nodejs , reboot my pc but still getting this error

$ npm install --global yo npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm C:\Users\hp\AppData\Roaming\npm\yo -> C:\Users\hp\AppData\Roaming\npm\node_modules\yo\lib\cli.js C:\Users\hp\AppData\Roaming\npm\yo-complete -> C:\Users\hp\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js

[email protected] postinstall C:\Users\hp\AppData\Roaming\npm\node_modules\yo\node_modules\spawn-sync node postinstall

[email protected] C:\Users\hp\AppData\Roaming\npm `-- (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\yo\node_modules\spawn-sync): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: node postinstall npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status -4058 npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--global" "yo" npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! file ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd npm ERR! path ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd

npm ERR! [email protected] postinstall: node postinstall npm ERR! spawn ;C:\Program Files\Git\bin;C:\Program Files\Git\cmd ENOENT npm ERR! npm ERR! Failed at the [email protected] postinstall script 'node postinstall'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the spawn-sync package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node postinstall npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs spawn-sync npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls spawn-sync npm ERR! There is likely additional logging output above. [email protected] C:\Users\hp\AppData\Roaming\npm `-- (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\yo\node_modules\spawn-sync): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: node postinstall npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status -4058 npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--global" "yo" npm ERR! node v6.9.2 npm ERR! npm v3.10.9

npm ERR! Callback called more than once. npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\hp\npm-debug.log npm ERR! code 1

Please tell me what is the problem with it.

2
IS there anyone who can answer this issueHassaan

2 Answers

0
votes

Happened to me too... in recent distributions many packages install nodejs as the node.js executable, while spawn-sync attempts to call node, that is why this fails.

As a workaround, you can create a softlink from node to nodejs. Something like:

sudo ln -s which nodejs /usr/bin/node

0
votes

Just install the latest version of nodejs and the error will get resolved.
Type the instructions in the terminal and node js will get updated:

  1. $ sudo apt purge nodejs (for removing previous files of node js)
  2. $ wget -qO- https://deb.nodesource.com/setup_7.x | sudo bash -(it will download latest version of node)
  3. $ sudo apt-get install nodejs

and it is done.