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
这个目录的node是homebrew安装的,只需要brew uninstall node就可以了。