mac 下 node.js 装 ionic 出现问题

2017-03-14 19:52:52 +08:00
 terencehyz

要把之前的 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
2878 次点击
所在节点    问与答
4 条回复
fytriht
2017-03-14 21:28:22 +08:00
用 cnpm 试试
terencehyz
2017-03-14 22:58:28 +08:00
@fytriht 啊哈😂😂😂
SourceMan
2017-03-14 23:00:00 +08:00
npm ERR! Please try running this command again as root/Administrator.

楼主钓鱼,大家小心
terencehyz
2017-03-14 23:07:41 +08:00
@SourceMan 我 sudo 弄的啊…之前都是在 windows 环境下弄的…然后今天用实验室的 Mac …然后就炸了…

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/347458

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX