2017-06-06 72 views
1

我想安裝jhipster來運行我已經克隆在/ home/thomas/Documents/softeng/project/CS673-Project中的版本庫。我無法解析丟失的東西。我運行的命令是sudo npm install -g generator-jhipster。 下面我已經包含了日誌的完整相關部分。在ubuntu上安裝generator-jhipster與npm時出錯16

11518 silly install [email protected] 
11519 info lifecycle [email protected]~install: [email protected] 
11520 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle false 
11521 verbose lifecycle [email protected]~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 [email protected]~install: CWD: /usr/local/lib/node_modules/generator-jhipster 
11523 silly lifecycle [email protected]~install: Args: [ '-c', 'tabtab install --name jhipster --auto' ] 
11524 silly lifecycle [email protected]~install: Returned: code: 1 signal: null 
11525 info lifecycle [email protected]~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: [email protected] 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 [email protected] 
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 [email protected] install: `tabtab install --name jhipster --auto` 
11536 error Exit status 1 
11537 error Failed at the [email protected] install script. 
11537 error This is probably not a problem with npm. There is likely additional logging output above. 
11538 verbose exit [ 1, true ] 

謝謝你這麼多

回答

1

我曾與在Ubuntu 16.10上運行一些較新的版本非常相同的錯誤:

11518 info lifecycle [email protected]~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: [email protected] 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 [email protected] 
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 [email protected] install: `tabtab install --name jhipster --auto` 
11529 error Exit status 1 
11530 error Failed at the [email protected] install script. 
11530 error This is probably not a problem with npm. There is likely additional logging output above. 
11531 verbose exit [ 1, true ] 

並且令人驚訝地輸出消息讓我比詳細的日誌更多:

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

> [email protected] 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! [email protected] install: `tabtab install --name jhipster --auto` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

在我們的安裝中肯定有npm權限的問題。 我解決它通過改變NPM配置的全局位置:

$ mkdir ~/.npm-global 

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

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

$ source ~/.profile 

然後,只需安裝jhipster沒有 '須藤':

npm install -g generator-jhipster 

這裏去一些更多的信息有關fixing npm permissions

「即使這個修復工作,這是一種煩人的需要弄清楚。「

希望它有幫助!

+0

但是你爲什麼要用'sudo'來安裝全局依賴? – vsenko

+0

嘿@vsenko,不是我真的很在乎這個。也許我在我的評論中不是很清楚,但是我遵循[jhipster的安裝配方](https://jhipster.github.io/installation/),我認爲安裝過程會非常簡單直到我沒有非常熟悉npm或nodejs。 –

+1

謝謝你的鏈接Reginaldo! 'sudo chown -R $(whoami)$(npm config獲取前綴)/ {lib/node_modules,bin,share}' 這個命令有竅門! – Unbekannt

1

我可以看到你的日誌,節點4.2.6。太舊了。試用版本6.10.3 LTS

+0

已更新,除一行外無變化。 –