我在使用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 npm@5.6.0
3 info using node@v8.9.3
4 verbose npm-session d82425d8a0613ce5
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall backstage@2.0.2
7 info lifecycle backstage@2.0.2~preinstall: backstage@2.0.2
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 backstage@2.0.2
15 silly saveTree ├── @types/lodash@4.14.66
15 silly saveTree ├─┬ aws-sdk@2.115.0
15 silly saveTree │ ├─┬ buffer@4.9.1
15 silly saveTree │ │ └── base64-js@https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz
15 silly saveTree │ ├── crypto-browserify@1.0.9
15 silly saveTree │ ├── events@https://registry.npmjs.org/events/-/events-1.1.1.tgz
15 silly saveTree │ ├── url@0.10.3
15 silly saveTree │ └── uuid@3.0.1
15 silly saveTree ├─┬ csv@1.1.1
15 silly saveTree │ ├── csv-generate@1.0.0
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 └─┬ event-stream@3.3.4
15 silly saveTree ├── duplexer@https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz
15 silly saveTree └── from@0.1.7
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": ""
}
任何形式的帮助都非常感激。我在那里挣扎了一个小时。什么都解决了这个问题。
答案 0 :(得分:0)
看起来像npm缓存文件夹中的权限问题:
>>> reflexive
matrix([[ True, True, False, True],
[False, True, True, False],
[False, False, True, False],
[False, False, False, True]])
>>> reflexive**4
matrix([[ True, True, True, True],
[False, True, True, False],
[False, False, True, False],
[False, False, False, True]])
>>> reflexive_symmetric
matrix([[ True, True, False, True],
[ True, True, True, False],
[False, True, True, False],
[ True, False, False, True]])
>>> reflexive_symmetric**4
matrix([[ True, True, True, True],
[ True, True, True, True],
[ True, True, True, True],
[ True, True, True, True]])
尝试将其彻底删除23 error /home/jahidul/.npm/_cacache/tmp/git-clone-3ae74a4b/.git: Permission denied
。
然后重新运行sudo rm -rf /home/jahidul/.npm/_cacache/
。
答案 1 :(得分:0)
这就是我最终做事的方式:
我删除了node.js版本8.9.3并安装了node.js版本v6.12.2。
它有效!!