yo icon indicating copy to clipboard operation
yo copied to clipboard

'node postinstall' failing with error ELIFECYCLE while running npm install -g yo

Open Pratyushpnd opened this issue 6 years ago • 4 comments

While trying to run the command npm install -g yo, I am getting the below error:

15987 verbose node v8.11.2 15988 verbose npm v5.6.0 15989 error file C:\Users\123
15990 error path C:\Users\123
15991 error code ELIFECYCLE 15992 error errno ENOENT 15993 error syscall spawn C:\Users\123
15994 error [email protected] postinstall: node postinstall 15994 error spawn C:\Users\123\ ENOENT 15995 error Failed at the [email protected] postinstall script. 15995 error This is probably not a problem with npm. There is likely additional logging output above. 15996 verbose exit [ 1, true ]

At first after running the command it is giving the below message: prefix "-g" is not recognized as an external or internal command.

Can anyone help me to get it installed.

Pratyushpnd avatar Jun 06 '18 17:06 Pratyushpnd

Please share the output of which node and which npm here.

rajat-np avatar Jun 14 '18 09:06 rajat-np

Could you share more information, please?

  • NodeJS version;
  • NPM version;
  • OS system and version;

willmendesneto avatar Jul 15 '18 12:07 willmendesneto

I have this problem as well.

which node: /Users/me/.nvm/versions/node/v0.12.18/bin/node which npm: /Users/me/.nvm/versions/node/v0.12.18/bin/npm

I get all the way down to the postinstall and hit a wall. NOTE: I know I'm behind the times version-wise, I'm trying to reload some old software that doesn't seem to like life with current versions. I am running macOS Sierra.

> [email protected] postinstall /Users/me/.nvm/versions/node/v0.12.18/lib/node_modules/yo/node_modules/tabtab/node_modules/inquirer/node_modules/external-editor/node_modules/spawn-sync
> node postinstall

/Users/me/.nvm/versions/node/v0.12.18/bin/yo -> /Users/me/.nvm/versions/node/v0.12.18/lib/node_modules/yo/lib/cli.js
/Users/me/.nvm/versions/node/v0.12.18/bin/yo-complete -> /Users/me/.nvm/versions/node/v0.12.18/lib/node_modules/yo/lib/completion/index.js

> [email protected] postinstall /Users/me/.nvm/versions/node/v0.12.18/lib/node_modules/yo
> yodoctor

module.js:338
    throw err;
          ^
Error: Cannot find module '.'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/me/.nvm/versions/node/v0.12.18/lib/node_modules/yo/node_modules/yeoman-doctor/lib/cli.js:3:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/me/.nvm/versions/node/v0.12.18/bin/node" "/Users/me/.nvm/versions/node/v0.12.18/bin/npm" "install" "-g" "yo"
npm ERR! node v0.12.18
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! [email protected] postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script 'yodoctor'.
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!     yodoctor
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs yo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/me/npm-debug.log

Thanks for any thoughts!

jetsetting-stressball avatar Oct 10 '18 17:10 jetsetting-stressball

@jetsetting-stressball Which yo version are you using. It's good to keep in mind that you need to check the versions that support your NodeJS version and use the latest ones won't work due to lack of few API's used in this repository. So that, if you're trying to solve your issue you should update your NodeJS version as soon as possible since NodeJS v0.12.18 is not supported by NodeJS team

willmendesneto avatar Oct 18 '18 11:10 willmendesneto