V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zeroday
V2EX  ›  问与答

npm install -g 错误

  •  
  •   zeroday · 2014-03-12 03:06:44 +08:00 · 3457 次点击
    这是一个创建于 3914 天前的主题,其中的信息可能已经有所发展或是发生改变。
    尝试在虚拟机中研究这个(https://github.com/pythoncn/june)开源论坛,结果搭载环境,各种出错。

    vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ npm install -g stylus
    npm http GET https://registry.npmjs.org/stylus
    npm http 304 https://registry.npmjs.org/stylus
    npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/stylus'
    npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/stylus']
    npm ERR! errno: 3,
    npm ERR! code: 'EACCES',
    npm ERR! path: '/usr/local/lib/node_modules/stylus',
    npm ERR! fstream_type: 'Directory',
    npm ERR! fstream_path: '/usr/local/lib/node_modules/stylus',
    npm ERR! fstream_class: 'DirWriter',
    npm ERR! fstream_stack:
    npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
    npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
    npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! System Linux 3.8.0-29-generic
    npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "stylus"
    npm ERR! cwd /vagrant/www/june
    npm ERR! node -v v0.10.24
    npm ERR! npm -v 1.3.21
    npm ERR! path /usr/local/lib/node_modules/stylus
    npm ERR! fstream_path /usr/local/lib/node_modules/stylus
    npm ERR! fstream_type Directory
    npm ERR! fstream_class DirWriter
    npm ERR! code EACCES
    npm ERR! errno 3
    npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/stylus'
    npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
    npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
    npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR! /vagrant/www/june/npm-debug.log
    npm ERR! not ok code 0
    4 条回复    1970-01-01 08:00:00 +08:00
    zeroday
        1
    zeroday  
    OP
       2014-03-12 03:08:10 +08:00
    vagrant@vagrant-ubuntu-ruby2:/vagrant/www/june$ vim npm-debug.log
    0 info it worked if it ends with ok
    1 verbose cli [ '/usr/local/bin/node',
    1 verbose cli '/usr/local/bin/npm',
    1 verbose cli 'install',
    1 verbose cli '-g',
    1 verbose cli 'stylus' ]
    2 info using [email protected]
    3 info using [email protected]
    4 verbose cache add [ 'stylus', null ]
    5 verbose cache add name=undefined spec="stylus" args=["stylus",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: 'stylus',
    6 verbose parsed url path: 'stylus',
    6 verbose parsed url href: 'stylus' }
    7 silly lockFile 27c0f414-stylus stylus
    8 verbose lock stylus /home/vagrant/.npm/27c0f414-stylus.lock
    "npm-debug.log" 258L, 16268C
    11
        2
    11  
       2014-03-12 03:36:22 +08:00   ❤️ 1
    sudo
    RIcter
        3
    RIcter  
       2014-03-12 07:47:01 +08:00   ❤️ 1
    -g需要sudo啦
    zeroday
        4
    zeroday  
    OP
       2014-03-12 13:41:34 +08:00
    @11
    @RIcter 加个sudo还需要挂个VPN就可以成功安装了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3714 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:24 · PVG 12:24 · LAX 20:24 · JFK 23:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.