npm安装spm出错,请问是什么问题。
发布于 12 年前 作者 yuchen 18615 次浏览 最后一次编辑是 8 年前

错误提示,请问什么问题,怎么解决?

npm install spm -g npm http GET https://registry.npmjs.org/spm npm http 200 https://registry.npmjs.org/spm npm http GET https://registry.npmjs.org/spm/-/spm-0.4.1.tgz npm http 200 https://registry.npmjs.org/spm/-/spm-0.4.1.tgz

npm ERR! Error: EACCES, mkdir ‘/usr/local/lib/node_modules/spm’ npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! npm ERR! System Darwin 12.2.0 npm ERR! command “node” “/usr/local/bin/npm” “install” “spm” “-g” npm ERR! cwd /Users/nameng npm ERR! node -v v0.6.15 npm ERR! npm -v 1.1.16 npm ERR! path /usr/local/lib/node_modules/spm npm ERR! fstream_path /usr/local/lib/node_modules/spm npm ERR! fstream_type Directory npm ERR! fstream_class DirWriter npm ERR! code EACCES npm ERR! message EACCES, mkdir ‘/usr/local/lib/node_modules/spm’ npm ERR! errno {} npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23 npm ERR! fstream_stack Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:42:17) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/nameng/npm-debug.log npm not ok

8 回复

npm ERR! Error: EACCES, mkdir ‘/usr/local/lib/node_modules/spm’ npm ERR! npm ERR! Please try running this command again as root/Administrator. 这两行是说没权限建文件夹,尝试用 root 或 administrator 帐号执行这个命令。补补英文吧……

使用root帐号执行安装spm,还是出现错误了,是因为我的node的版本太低了吗?

npm install spm -g npm http GET https://registry.npmjs.org/spm npm http 200 https://registry.npmjs.org/spm npm http GET https://registry.npmjs.org/spm/-/spm-0.4.1.tgz npm http 200 https://registry.npmjs.org/spm/-/spm-0.4.1.tgz npm http GET https://registry.npmjs.org/uglify-js npm http GET https://registry.npmjs.org/seajs npm http 200 https://registry.npmjs.org/seajs npm http GET https://registry.npmjs.org/seajs/-/seajs-1.3.0.tgz npm http 200 https://registry.npmjs.org/uglify-js npm http GET https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.0.tgz npm http 200 https://registry.npmjs.org/seajs/-/seajs-1.3.0.tgz npm http 200 https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.0.tgz npm http GET https://registry.npmjs.org/source-map npm http GET https://registry.npmjs.org/optimist npm http 200 https://registry.npmjs.org/optimist npm http GET https://registry.npmjs.org/optimist/-/optimist-0.3.5.tgz npm http 200 https://registry.npmjs.org/source-map

npm ERR! Error: No compatible version found: source-map@’>=0.1.7- <0.2.0-‘ npm ERR! Valid install targets: npm ERR! [“0.0.0”,“0.1.0”,“0.1.1”,“0.1.2”,“0.1.3”] npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:486:10) npm ERR! at next_ (/usr/local/lib/node_modules/npm/lib/cache.js:436:17) npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:413:44) npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:406:5 npm ERR! at saved (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:151:7) npm ERR! at Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:230:7) npm ERR! You may report this log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! npm-@googlegroups.com npm ERR! npm ERR! System Darwin 12.2.0 npm ERR! command “node” “/usr/local/bin/npm” “install” “spm” "-g" npm ERR! cwd /private/var/root npm ERR! node -v v0.6.15 npm ERR! npm -v 1.1.16 npm ERR! message No compatible version found: source-map@’>=0.1.7- <0.2.0-' npm ERR! message Valid install targets: npm ERR! message [“0.0.0”,“0.1.0”,“0.1.1”,“0.1.2”,“0.1.3”] npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /private/var/root/npm-debug.log npm not ok

升级了node到0.8.14

node -v
v0.8.14

安装spm还是报错

root# npm install spm -g
npm http GET https://registry.npmjs.org/spm
npm http 304 https://registry.npmjs.org/spm
npm http GET https://registry.npmjs.org/spm/-/spm-1.1.2.tgz
npm http 200 https://registry.npmjs.org/spm/-/spm-1.1.2.tgz

npm ERR! SyntaxError: Unexpected end of input
npm ERR!     at Object.parse (native)
npm ERR!     at Packer.readRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:174:31)
npm ERR!     at Packer.IgnoreReader.addIgnoreFile (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR!     at fs.readFile (fs.js:176:14)
npm ERR!     at fs.close (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "spm" "-g"
npm ERR! cwd /private/var/root
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.16
npm ERR! type unexpected_eos
npm ERR! arguments []
npm ERR! message Unexpected end of input
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/root/npm-debug.log
npm not ok

spm 还是从源码编译吧。去官方提bug,spm的作者们每天都在。。回复的都超级及时- -。

上周改版改动非常大。。还换了新源。。

谢谢你提醒

从错误信息看,是没有权限创建目录权限,尝试用sudo npm install.

回到顶部