2014-03-24 60 views
0

每當我嘗試使用全局節點安裝某些東西時,出現一堆錯誤。我只是在Powershell中試過它,並沒有發現任何錯誤,但可能是因爲它是Powershell,而不是安裝的官方Node命令行應用程序。我試過Powershell,因爲我認爲我可能能夠複製和粘貼錯誤,但我不能/他們沒有出現。我在官方節點控制檯中再次嘗試,並再次得到錯誤。底部有錯誤截圖。Node.js在使用-g標誌時總是給出錯誤

這裏是當我試圖npm install learnyounode -g時生成的NPM-文件的debug.log:

0 info it worked if it ends with ok 
1 verbose cli [ 'node', 
1 verbose cli 'C:\\Users\\Tierney\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'install', 
1 verbose cli 'learnyounode', 
1 verbose cli '-g' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose cache add [ 'learnyounode', null ] 
5 verbose cache add name=undefined spec="learnyounode" args=["learnyounode",null] 
6 verbose parsed url { protocol: null, 
6 verbose parsed url slashes: null, 
6 verbose parsed url auth: null, 
6 verbose parsed url host: null, 
6 verbose parsed url port: null, 
6 verbose parsed url hostname: null, 
6 verbose parsed url hash: null, 
6 verbose parsed url search: null, 
6 verbose parsed url query: null, 
6 verbose parsed url pathname: 'learnyounode', 
6 verbose parsed url path: 'learnyounode', 
6 verbose parsed url href: 'learnyounode' } 
7 silly lockFile 8d456d9f-learnyounode learnyounode 
8 verbose lock learnyounode C:\Users\Tierney\AppData\Roaming\npm-cache\8d456d9f-learnyounode.lock 
9 silly lockFile 8d456d9f-learnyounode learnyounode 
10 silly lockFile 8d456d9f-learnyounode learnyounode 
11 verbose addNamed [ 'learnyounode', '' ] 
12 verbose addNamed [ null, '*' ] 
13 silly lockFile a353de34-learnyounode [email protected] 
14 verbose lock [email protected] C:\Users\Tierney\AppData\Roaming\npm-cache\a353de34-learnyounode.lock 
15 silly addNameRange { name: 'learnyounode', range: '*', hasData: false } 
16 verbose url raw learnyounode 
17 verbose url resolving [ 'https://registry.npmjs.org/', './learnyounode' ] 
18 verbose url resolved https://registry.npmjs.org/learnyounode 
19 info trying registry request attempt 1 at 17:41:57 
20 verbose etag "BOCKXHU6AMIWDF78HOHVQMZBJ" 
21 http GET https://registry.npmjs.org/learnyounode 
22 http 304 https://registry.npmjs.org/learnyounode 
23 silly registry.get cb [ 304, 
23 silly registry.get { date: 'Mon, 24 Mar 2014 21:42:04 GMT', 
23 silly registry.get  server: 'Apache', 
23 silly registry.get  via: '1.1 varnish', 
23 silly registry.get  'last-modified': 'Mon, 24 Mar 2014 21:42:04 GMT', 
23 silly registry.get  'cache-control': 'max-age=1', 
23 silly registry.get  etag: '"BOCKXHU6AMIWDF78HOHVQMZBJ"', 
23 silly registry.get  'x-served-by': 'cache-c48-CHI', 
23 silly registry.get  'x-cache': 'MISS', 
23 silly registry.get  'x-cache-hits': '0', 
23 silly registry.get  'x-timer': 'S1395697324.748315096,VS0,VE121', 
23 silly registry.get  vary: 'Accept', 
23 silly registry.get  'content-length': '0', 
23 silly registry.get  'keep-alive': 'timeout=10, max=50', 
23 silly registry.get  connection: 'Keep-Alive' } ] 
24 verbose etag learnyounode from cache 
25 silly addNameRange number 2 { name: 'learnyounode', range: '*', hasData: true } 
26 silly addNameRange versions [ 'learnyounode', 
26 silly addNameRange [ '0.0.0', 
26 silly addNameRange  '0.0.1', 
26 silly addNameRange  '0.0.2', 
26 silly addNameRange  '0.0.3', 
26 silly addNameRange  '0.0.4', 
26 silly addNameRange  '0.0.5', 
26 silly addNameRange  '0.0.6', 
26 silly addNameRange  '0.0.7', 
26 silly addNameRange  '0.0.8', 
26 silly addNameRange  '0.0.9', 
26 silly addNameRange  '0.1.0', 
26 silly addNameRange  '0.1.1', 
26 silly addNameRange  '0.2.0', 
26 silly addNameRange  '0.2.1', 
26 silly addNameRange  '0.2.2', 
26 silly addNameRange  '0.2.3', 
26 silly addNameRange  '0.2.4', 
26 silly addNameRange  '0.2.5', 
26 silly addNameRange  '0.2.6', 
26 silly addNameRange  '0.2.7', 
26 silly addNameRange  '0.2.8', 
26 silly addNameRange  '0.2.9', 
26 silly addNameRange  '0.2.10', 
26 silly addNameRange  '0.2.11', 
26 silly addNameRange  '0.2.12', 
26 silly addNameRange  '0.2.13', 
26 silly addNameRange  '0.2.14', 
26 silly addNameRange  '0.2.15', 
26 silly addNameRange  '0.2.16', 
26 silly addNameRange  '0.2.16-mimbug', 
26 silly addNameRange  '0.3.0', 
26 silly addNameRange  '0.3.1', 
26 silly addNameRange  '0.3.2', 
26 silly addNameRange  '0.3.3', 
26 silly addNameRange  '0.4.0', 
26 silly addNameRange  '0.4.1', 
26 silly addNameRange  '1.0.0-alpha01', 
26 silly addNameRange  '1.0.0' ] ] 
27 verbose addNamed [ 'learnyounode', '1.0.0' ] 
28 verbose addNamed [ '1.0.0', '1.0.0' ] 
29 silly lockFile 0820d686-learnyounode-1-0-0 [email protected] 
30 verbose lock [email protected] C:\Users\Tierney\AppData\Roaming\npm-cache\0820d686-learnyounode-1-0-0.lock 
31 silly lockFile 0820d686-learnyounode-1-0-0 [email protected] 
32 silly lockFile 0820d686-learnyounode-1-0-0 [email protected] 
33 silly lockFile a353de34-learnyounode [email protected] 
34 silly lockFile a353de34-learnyounode [email protected] 
35 silly resolved [ { name: 'learnyounode', 
35 silly resolved  version: '1.0.0', 
35 silly resolved  description: 'Learn You The Node.js For Much Win! An intro to Node.js via a set of self-guided workshops.', 
35 silly resolved  author: 
35 silly resolved  { name: 'Rod Vagg', 
35 silly resolved  email: '[email protected]', 
35 silly resolved  url: 'https://github.com/rvagg' }, 
35 silly resolved  contributors: [ [Object], [Object], [Object], [Object], [Object], [Object] ], 
35 silly resolved  repository: 
35 silly resolved  { type: 'git', 
35 silly resolved  url: 'https://github.com/rvagg/learnyounode.git' }, 
35 silly resolved  license: 'MIT', 
35 silly resolved  dependencies: 
35 silly resolved  { workshopper: '^1.0.0-alpha05', 
35 silly resolved  'workshopper-exercise': '^0.2.2', 
35 silly resolved  'workshopper-wrappedexec': '^0.1.1', 
35 silly resolved  'workshopper-boilerplate': '0.0.1', 
35 silly resolved  'concat-stream': '^1.4.1', 
35 silly resolved  duplexer: '^0.1.1', 
35 silly resolved  through: '^2.3.4', 
35 silly resolved  boganipsum: '^0.1.0', 
35 silly resolved  hyperquest: '^0.2.0', 
35 silly resolved  bl: '^0.7.0', 
35 silly resolved  'through2-map': '^1.2.1', 
35 silly resolved  'colors-tmpl': '^0.1.0', 
35 silly resolved  after: '^0.8.1', 
35 silly resolved  rimraf: '^2.2.6', 
35 silly resolved  chalk: '^0.4.0', 
35 silly resolved  through2: '^0.4.1' }, 
35 silly resolved  bin: { learnyounode: './learnyounode.js' }, 
35 silly resolved  preferGlobal: true, 
35 silly resolved  readme: '# Learn You The Node.js For Much Win!\n\n**An intro to Node.js via a set of self-guided workshops.**\n\n[![NPM](https://nodei.co/npm/learnyounode.png?downloads=true&stars=true)](https://nodei.co/npm/learnyounode/) [![NPM](https://nodei.co/npm-dl/learnyounode.png?months=3)](https://nodei.co/npm/learnyounode/)\n\n![Learn You The Node.js For Much Win!](https://raw.github.com/rvagg/learnyounode/master/learnyounode.png)\n\n 1. Install [Node.js](http://nodejs.org/)\n 2. Run `sudo npm install learnyounode -g`\n 3. Run `learnyounode`\n 4. **.. profit!**\n\n<b><code>learnyounode</code></b> will run through a series of Node.js workshops. Starting at a basic *"HELLO WORLD"* and moving on to more advanced exercises about dealing with synchronous & asynchronous I/O, filesystem operations, TCP and HTTP networking, events and streams.\n\nOnce you have finished <b><code>learnyounode</code></b>, graduate to <b><code>[stream-adventure](https://github.com/substack/stream-adventure)</code></b> for a set of exercises that dig in to Node\'s streams.\n\n### Contributors\n\n<b><code>learnyounode</code></b> is proudly brought to you by the following hackers:\n\n<table><tbody>\n<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>\n<tr><th align="left">Andrey Sidorov</th><td><a href="https://github.com/sidorares">GitHub/sidorares</a></td><td><a href="http://twitter.com/sidorares">Twitter/@sidorares</a></td></tr>\n<tr><th align="left">Julián Duque</th><td><a href="https://github.com/julianduque">GitHub/julianduque</a></td><td><a href="http://twitter.com/julian_duque">Twitter/@julian_duque</a></td></tr>\n<tr><th align="left">Lars-Magnus Skog</th><td><a href="https://github.com/ralphtheninja">GitHub/ralphtheninja</a></td><td><a href="http://twitter.com/ralphtheninja">Twitter/@ralphtheninja</a></td></tr>\n<tr><th align="left">Tim Inman</th><td><a href="https://github.com/thehack">GitHub/thehack</a></td><td><a href="http://twitter.com/timinman">Twitter/@timinman</a></td></tr>\n<tr><th align="left">Dan Flettre</th><td><a href="https://github.com/Flet">GitHub/Flet</a></td><td><a href="http://twitter.com/flettre">Twitter/@flettre</a></td></tr>\n</tbody></table>\n\n## License\n\n**learnyounode** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.\n\n**learnyounode** builds on the excellent work by [@substack](https://github.com/substack) and [@maxogden](https://github.com/maxogden) who created **[stream-adventure](https://github.com/substack/stream-adventure)** which serves as the original foundation for **learnyounode**.\n', 
35 silly resolved  readmeFilename: 'README.md', 
35 silly resolved  bugs: { url: 'https://github.com/rvagg/learnyounode/issues' }, 
35 silly resolved  homepage: 'https://github.com/rvagg/learnyounode', 
35 silly resolved  _id: '[email protected]', 
35 silly resolved  _from: '[email protected]' } ] 
36 info install [email protected] into C:\Program Files\nodejs 
37 info installOne lear[email protected] 
38 info C:\Program Files\nodejs\node_modules\learnyounode unbuild 
39 verbose tar unpack C:\Users\Tierney\AppData\Roaming\npm-cache\learnyounode\1.0.0\package.tgz 
40 silly lockFile 6248517b-nodejs-node-modules-learnyounode tar://C:\Program Files\nodejs\node_modules\learnyounode 
41 verbose lock tar://C:\Program Files\nodejs\node_modules\learnyounode C:\Users\Tierney\AppData\Roaming\npm-cache\6248517b-nodejs-node-modules-learnyounode.lock 
42 silly lockFile 09a6ffd0-e-learnyounode-1-0-0-package-tgz tar://C:\Users\Tierney\AppData\Roaming\npm-cache\learnyounode\1.0.0\package.tgz 
43 verbose lock tar://C:\Users\Tierney\AppData\Roaming\npm-cache\learnyounode\1.0.0\package.tgz C:\Users\Tierney\AppData\Roaming\npm-cache\09a6ffd0-e-learnyounode-1-0-0-package-tgz.lock 
44 silly gunzTarPerm modes [ '755', '644' ] 
45 error Error: EPERM, mkdir 'C:\Program Files\nodejs\node_modules\learnyounode' 
45 error { [Error: EPERM, mkdir 'C:\Program Files\nodejs\node_modules\learnyounode'] 
45 error errno: 50, 
45 error code: 'EPERM', 
45 error path: 'C:\\Program Files\\nodejs\\node_modules\\learnyounode', 
45 error fstream_type: 'Directory', 
45 error fstream_path: 'C:\\Program Files\\nodejs\\node_modules\\learnyounode', 
45 error fstream_class: 'DirWriter', 
45 error fstream_stack: 
45 error [ 'C:\\Users\\Tierney\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\fstream\\lib\\dir-writer.js:36:23', 
45 error  'C:\\Users\\Tierney\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\mkdirp\\index.js:37:53', 
45 error  'Object.oncomplete (fs.js:107:15)' ] } 
46 error Please try running this command again as root/Administrator. 
47 error System Windows_NT 6.2.9200 
48 error command "node" "C:\\Users\\Tierney\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "learnyounode" "-g" 
49 error cwd C:\Users\Tierney\node\learnyounode 
50 error node -v v0.10.26 
51 error npm -v 1.4.4 
52 error path C:\Program Files\nodejs\node_modules\learnyounode 
53 error fstream_path C:\Program Files\nodejs\node_modules\learnyounode 
54 error fstream_type Directory 
55 error fstream_class DirWriter 
56 error code EPERM 
57 error errno 50 
58 error stack Error: EPERM, mkdir 'C:\Program Files\nodejs\node_modules\learnyounode' 
59 error fstream_stack C:\Users\Tierney\AppData\Roaming\npm\node_modules\npm\node_modules\fstream\lib\dir-writer.js:36:23 
59 error fstream_stack C:\Users\Tierney\AppData\Roaming\npm\node_modules\npm\node_modules\mkdirp\index.js:37:53 
59 error fstream_stack Object.oncomplete (fs.js:107:15) 
60 verbose exit [ 50, true ] 

console with errors

+1

看起來像一個權限錯誤,請嘗試以管理員身份運行 – zajd

回答

3

如果您使用的圖標快捷方式啓動命令行,右擊並選擇「以管理員身份運行」而不是雙擊,然後再次運行該命令。

贈品是文字「請嘗試以root/Administrator身份再次運行此命令」。

+0

謝謝,我是一個白癡。 – bitandbang