node.js - node升级安装插件出错
天蓬老师
天蓬老师 2017-04-17 13:00:54
[Node.js讨论组]

mac环境,我把node的版本从0.12升级到5.0,然后安装gulp-sass,报错了。

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/0.12.2_1/bin/node" "/usr/local/bin/npm" "install" "gulp-sass"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6

npm ERR! Cannot read property 'localeCompare' of undefined
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/LiaoYingRay/Projects/coding/rayliao/npm-debug.log

好像是node的路径问题,还停留在0.12版本的路径上?请问有人知道怎么解决吗?


npm的issue上说是npm的版本问题,所以我尝试安装升级npm:npm install -g npm@latest
但还是出错了。

pm@3.3.10 

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/0.12.2_1/bin/node" "/usr/local/bin/npm" "install" "-g" "npm@latest"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
npm ERR! path /usr/local/lib/node_modules/npm/node_modules/ansi-styles
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/ansi-styles'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/ansi-styles']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/npm/node_modules/ansi-styles' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator



我把node的版本换回4.2.1就没事了!
不过我有点在意的就是,为什么我升级了node,可本地的node目录还是只有0.12那个?

usr/local/Cellar/node/0.12.2_1
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复(2)
阿神
usr/local/Cellar/node/0.12.2_1

这个目录的node是homebrew安装的,只需要brew uninstall node就可以了。

阿神

node升级一些 node_modudel c/c++实现的 都要重新编译的

使用 node-gyp

node-gyp --help 看些提示 里面有写怎么重新编译

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号