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

mac 下 node.js 装 ionic 出现问题

  •  
  •   terencehyz · 2017-03-14 19:52:52 +08:00 · 2959 次点击
    这是一个创建于 2812 天前的主题,其中的信息可能已经有所发展或是发生改变。

    要把之前的 ionic 项目打包成 ios 版本,但是出现了一些小意外,不知道该怎么解决 打开 terminal 运行sudo npm install -g ionic cordova出现下面错误

    npm ERR! Darwin 15.6.0
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
    npm ERR! node v7.6.0
    npm ERR! npm v4.1.2
    npm ERR! path /usr/local/lib/node_modules/.staging/ansi-392b32ed
    npm ERR! code ENOENT
    npm ERR! errno -2
    npm ERR! syscall rename
    
    npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/ansi-392b32ed' -> '/usr/local/lib/node_modules/ionic/node_modules/cordova-lib/node_modules/ansi'
    npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/ansi-392b32ed' -> '/usr/local/lib/node_modules/ionic/node_modules/cordova-lib/node_modules/ansi'
    npm ERR! enoent This is most likely not a problem with npm itself
    npm ERR! enoent and is related to npm not being able to find a file.
    npm ERR! enoent 
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /Users/imudges_lpr/npm-debug.log
    

    然后重新安装了一遍 node 再执行,报下面的错误

    npm ERR! Darwin 15.6.0
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
    npm ERR! node v6.10.0
    npm ERR! npm v3.10.10
    npm ERR! path /usr/local/lib/node_modules/ionic/node_modules/gulp-util/node_modules/through2/node_modules/readable-stream
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access
    
    npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/ionic/node_modules/gulp-util/node_modules/through2/node_modules/readable-stream'
    npm ERR!     at Error (native)
    npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/ionic/node_modules/gulp-util/node_modules/through2/node_modules/readable-stream'
    npm ERR!     at Error (native)
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/local/lib/node_modules/ionic/node_modules/gulp-util/node_modules/through2/node_modules/readable-stream' }
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator.
    npm ERR! Darwin 15.6.0
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
    npm ERR! node v6.10.0
    npm ERR! npm v3.10.10
    npm ERR! path npm-debug.log.2588628427
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall open
    
    npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.2588628427'
    npm ERR!     at Error (native)
    npm ERR!  { Error: EACCES: permission denied, open 'npm-debug.log.2588628427'
    npm ERR!     at Error (native)
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'open',
    npm ERR!   path: 'npm-debug.log.2588628427' }
    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!     /usr/local/lib/node_modules/npm-debug.log
    
    4 条回复    2017-03-14 23:07:41 +08:00
    fytriht
        1
    fytriht  
       2017-03-14 21:28:22 +08:00 via Android
    用 cnpm 试试
    terencehyz
        2
    terencehyz  
    OP
       2017-03-14 22:58:28 +08:00 via iPhone
    @fytriht 啊哈😂😂😂
    SourceMan
        3
    SourceMan  
       2017-03-14 23:00:00 +08:00 via iPhone
    npm ERR! Please try running this command again as root/Administrator.

    楼主钓鱼,大家小心
    terencehyz
        4
    terencehyz  
    OP
       2017-03-14 23:07:41 +08:00 via iPhone
    @SourceMan 我 sudo 弄的啊…之前都是在 windows 环境下弄的…然后今天用实验室的 Mac …然后就炸了…
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1109 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 23:31 · PVG 07:31 · LAX 15:31 · JFK 18:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.