我对node.js非常全新,并尝试安装快速框架,不太确定为什么我安装Express时
$ npm express install --save
它给了我这个package.json test@1.0.0没有README数据 然后很多ERR!
由于
调试日志
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'express', '--save' ]
2 info using npm@2.7.4
3 info using node@v0.12.2
4 warn package.json test@1.0.0 No README data
5 silly cache add args [ 'express', null ]
6 verbose cache add spec express
7 silly cache add parsed spec { raw: 'express',
7 silly cache add scope: null,
7 silly cache add name: 'express',
7 silly cache add rawSpec: '',
7 silly cache add spec: '*',
7 silly cache add type: 'range' }
8 verbose addNamed express@*
9 silly addNamed semver.valid null
10 silly addNamed semver.validRange *
11 silly addNameRange { name: 'express', range: '*', hasData: false }
12 silly mapToRegistry name express
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/express
16 verbose addNameRange registry:https://registry.npmjs.org/express not in flight; fetching
17 verbose request uri https://registry.npmjs.org/express
18 verbose request no auth needed
19 info attempt registry request try #1 at 3:02:08 PM
20 verbose request id 42abc9c7545a84ee
21 verbose etag "5QPC4D9F40JTXPEZQJQJ5L09D"
22 http request GET https://registry.npmjs.org/express
23 http 304 https://registry.npmjs.org/express
24 silly get cb [ 304,
24 silly get { date: 'Sat, 09 May 2015 07:02:18 GMT',
24 silly get via: '1.1 varnish',
24 silly get 'cache-control': 'max-age=60',
24 silly get etag: '"5QPC4D9F40JTXPEZQJQJ5L09D"',
24 silly get age: '36',
24 silly get connection: 'keep-alive',
24 silly get 'x-served-by': 'cache-hkg6823-HKG',
24 silly get 'x-cache': 'HIT',
24 silly get 'x-cache-hits': '1',
24 silly get 'x-timer': 'S1431154938.074288,VS0,VE2',
24 silly get vary: 'Accept' } ]
25 verbose etag https://registry.npmjs.org/express from cache
26 verbose get saving express to /Users/clarkho/.npm/registry.npmjs.org/express/.cache.json
从终端登录
npm WARN package.json test@1.0.0 No README data
npm ERR! Darwin 12.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "express" "--save"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /Users/clarkho/.npm/debug/2.1.3
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/Users/clarkho/.npm/debug/2.1.3'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/Users/clarkho/.npm/debug/2.1.3']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/clarkho/.npm/debug/2.1.3',
npm ERR! parent: 'express' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/clarkho/Localhost/nodeapp/npm-debug.log
答案 0 :(得分:1)
从终端报告中记录,npm没有来自当前用户的目录/Users/clarkho/.npm/debug/2.1.3的权限。 您可以更改权限:
sudo chown -R $(whoami) /Users/clarkho/.npm/debug/2.1.3
或使用sudo运行npm
sudo npm install express --save