我在使用npm版本v5.6.0和节点版本v8.9.3的ubuntu 16.04.3上遇到错误。
我试过npm install
和sudo npm install
两者返回相同的结果。
这是完整的日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'i' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session d82425d8a0613ce5
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall [email protected]
7 info lifecycle [email protected]~preinstall: [email protected]
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 silly pacote git manifest for doc-templater@git://github.com/uncletammy/doc-templater.git#a2259af5a9f0997160a5a4ed392e963f2172c6ac fetched in 924ms
14 silly fetchPackageMetaData error for grunt-contrib-uglify@git://github.com/gruntjs/grunt-contrib-uglify.git#049052f76c5b6e80ac1d7d256f4c450f00067936 Command failed: /usr/bin/git clone -q git://github.com/gruntjs/grunt-contrib-uglify.git /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b
14 silly fetchPackageMetaData /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b/.git: Permission denied
15 silly saveTree [email protected]
15 silly saveTree ├── @types/[email protected]
15 silly saveTree ├─┬ [email protected]
15 silly saveTree │ ├─┬ [email protected]
15 silly saveTree │ │ └── base64-js@https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz
15 silly saveTree │ ├── [email protected]
15 silly saveTree │ ├── events@https://registry.npmjs.org/events/-/events-1.1.1.tgz
15 silly saveTree │ ├── [email protected]
15 silly saveTree │ └── [email protected]
15 silly saveTree ├─┬ [email protected]
15 silly saveTree │ ├── [email protected]
15 silly saveTree │ ├── csv-parse@https://registry.npmjs.org/csv-parse/-/csv-parse-1.2.1.tgz
15 silly saveTree │ └── csv-stringify@https://registry.npmjs.org/csv-stringify/-/csv-stringify-1.0.4.tgz
15 silly saveTree └─┬ [email protected]
15 silly saveTree ├── duplexer@https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz
15 silly saveTree └── [email protected]
16 verbose stack Error: Command failed: /usr/bin/git clone -q git://github.com/gruntjs/grunt-contrib-uglify.git /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b
16 verbose stack /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b/.git: Permission denied
16 verbose stack
16 verbose stack at ChildProcess.exithandler (child_process.js:275:12)
16 verbose stack at emitTwo (events.js:126:13)
16 verbose stack at ChildProcess.emit (events.js:214:7)
16 verbose stack at maybeClose (internal/child_process.js:925:16)
16 verbose stack at Socket.stream.socket.on (internal/child_process.js:346:11)
16 verbose stack at emitOne (events.js:116:13)
16 verbose stack at Socket.emit (events.js:211:7)
16 verbose stack at Pipe._handle.close [as _onclose] (net.js:554:12)
17 verbose cwd /home/jahidul/workspace/backstage
18 verbose Linux 4.10.0-28-generic
19 verbose argv "/usr/bin/node" "/usr/bin/npm" "i"
20 verbose node v8.9.3
21 verbose npm v5.6.0
22 error code 1
23 error Command failed: /usr/bin/git clone -q git://github.com/gruntjs/grunt-contrib-uglify.git /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b
23 error /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b/.git: Permission denied
24 verbose exit [ 1, true ]
的package.json
{
"engines": {
"node": "6.11.1"
},
"dependencies": {
"grunt": "^0.4.5",
"grunt-contrib-uglify": "git://github.com/gruntjs/grunt-contrib-uglify.git#harmony"
},
"license": ""
}
任何形式的帮助真的很感激。我在那里挣扎了一个小时。没有什么能解决这个问题。
在你的npm缓存文件夹中看起来像权限问题:
23 error /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b/.git: Permission denied
尝试完全删除它qazxsw poi。
然后重新运行sudo rm -rf /home/jahidul/.npm/_cacache/
。
这就是我最终做的事情:
我删除了node.js版本8.9.3并安装了node.js版本v6.12.2。
它工作了!!