简体   繁体   中英

Error installing generator-jhipster with npm on ubuntu 16

I am trying to install jhipster to run a repository I have already cloned in /home/thomas/Documents/softeng/project/CS673-Project. I cant parse what is missing. the command I've run is sudo npm install -g generator-jhipster. Below I have included the complete relevant section of the log.

11518 silly install generator-jhipster@4.5.2
11519 info lifecycle generator-jhipster@4.5.2~install: generator-jhipster@4.5.2
11520 verbose lifecycle generator-jhipster@4.5.2~install: unsafe-perm in lifecycle false
11521 verbose lifecycle generator-jhipster@4.5.2~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/lib/node_modules/generator-jhipster/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
11522 verbose lifecycle generator-jhipster@4.5.2~install: CWD: /usr/local/lib/node_modules/generator-jhipster
11523 silly lifecycle generator-jhipster@4.5.2~install: Args: [ '-c', 'tabtab install --name jhipster --auto' ]
11524 silly lifecycle generator-jhipster@4.5.2~install: Returned: code: 1  signal: null
11525 info lifecycle generator-jhipster@4.5.2~install: Failed to exec install script
11526 verbose unlock done using /home/thomas/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
11527 verbose stack Error: generator-jhipster@4.5.2 install: `tabtab install --name jhipster --auto`
11527 verbose stack Exit status 1
11527 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
11527 verbose stack     at emitTwo (events.js:87:13)
11527 verbose stack     at EventEmitter.emit (events.js:172:7)
11527 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
11527 verbose stack     at emitTwo (events.js:87:13)
11527 verbose stack     at ChildProcess.emit (events.js:172:7)
11527 verbose stack     at maybeClose (internal/child_process.js:821:16)
11527 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
11528 verbose pkgid generator-jhipster@4.5.2
11529 verbose cwd /home/thomas/Documents/softeng/project/CS673-Project
11530 verbose Linux 4.4.0-53-generic
11531 verbose argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install" "-g" "generator-jhipster"
11532 verbose node v4.2.6
11533 verbose npm  v5.0.3
11534 error code ELIFECYCLE
11535 error errno 1
11536 error generator-jhipster@4.5.2 install: `tabtab install --name jhipster --auto`
11536 error Exit status 1
11537 error Failed at the generator-jhipster@4.5.2 install script.
11537 error This is probably not a problem with npm. There is likely additional logging output above.
11538 verbose exit [ 1, true ]

Thank you so much

I can see in your log, node 4.2.6. It's too old. Try the version 6.10.3 LTS

I had the very same error with some newer versions running in ubuntu 16.10:

11518 info lifecycle generator-jhipster@4.5.5~install: Failed to exec 
install script
11519 verbose unlock done using 
/home/reginaldosantos/.npm/_locks/staging-3a08f0df5026584d.lock for 
/usr/local/lib/node_modules/.staging
11520 verbose stack Error: generator-jhipster@4.5.5 install: `tabtab install --name jhipster --auto`
11520 verbose stack Exit status 1
11520 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
11520 verbose stack     at emitTwo (events.js:106:13)
11520 verbose stack     at EventEmitter.emit (events.js:191:7)
11520 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
11520 verbose stack     at emitTwo (events.js:106:13)
11520 verbose stack     at ChildProcess.emit (events.js:191:7)
11520 verbose stack     at maybeClose (internal/child_process.js:891:16)
11520 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
11521 verbose pkgid generator-jhipster@4.5.5
11522 verbose cwd /home/reginaldosantos
11523 verbose Linux 4.4.0-78-generic
11524 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "generator-jhipster"
11525 verbose node v6.11.0
11526 verbose npm  v5.0.3
11527 error code ELIFECYCLE
11528 error errno 1
11529 error generator-jhipster@4.5.5 install: `tabtab install --name jhipster --auto`
11529 error Exit status 1
11530 error Failed at the generator-jhipster@4.5.5 install script.
11530 error This is probably not a problem with npm. There is likely additional logging output above.
11531 verbose exit [ 1, true ]

And surprisingly the output message helped me more than the detailed log:

/usr/local/bin/jhipster -> /usr/local/lib/node_modules/generator-jhipster/cli/jhipster.js

> generator-jhipster@4.5.5 install /usr/local/lib/node_modules/generator-jhipster
> tabtab install --name jhipster --auto

  tabtab:installer Installing completion script to bashrc directory +0ms

Error: You don't have permission to write to /home/reginaldosantos/.bashrc.
Try running with sudo instead:

  sudo /usr/local/bin/node /usr/local/lib/node_modules/generator-jhipster/node_modules/.bin/tabtab install --name jhipster --auto

oh oh Error: EACCES: permission denied, open '/home/reginaldosantos/.bashrc'
    at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! generator-jhipster@4.5.5 install: `tabtab install --name jhipster --auto`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the generator-jhipster@4.5.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It is definitely some problem with npm permissions in our installation. I solved it by changing npm configuration to a global location:

$ mkdir ~/.npm-global

$ sudo npm config set prefix '~/.npm-global'

$ echo "export PATH=~/.npm-global/bin:\$PATH" >> ~/.profile

$ source ~/.profile

Then simply install jhipster without 'sudo':

npm install -g generator-jhipster

Here goes some more information about fixing npm permissions

"Even though this fix works, it is kind of annoying needing to figure this out."

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM