nodejs npm安装出现typeError: Object #<Object> has no method 'match'

coat 发布于 2014/01/14 22:07
阅读 2K+
收藏 0
npm ERR! TypeError: Object #<Object> has no method 'match'
npm ERR!     at Object.scriptpath_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:138:23)
npm ERR!     at Array.forEach (native)
npm ERR!     at scriptpath (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:132:19)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:119:33
npm ERR!     at Array.forEach (native)
npm ERR!     at extras (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:118:21)
npm ERR!     at parseJson (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:87:17)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:59:33
npm ERR!     at fs.js:266:14
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-installed/node_modules/read-package-json/node_modules/graceful-fs/graceful-fs.js:103:5
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>


npm ERR! System Linux 3.2.0-4-amd64
npm ERR! command "node" "/usr/local/bin/npm" "install" "hexo" "-g"
npm ERR! cwd /home/coat
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.23
npm ERR! type undefined_method
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/coat/npm-debug.log
npm ERR! not ok code 0

 
 
 
 
加载中
0
养大虾
养大虾
-g参数为安装全局包,那肯定是要写到/home/coat这个目录之外了(可能是/usr/*下面),安装全局包你最好用root用户操作。
0
coat
coat

引用来自“YangRongZhou”的答案

-g参数为安装全局包,那肯定是要写到/home/coat这个目录之外了(可能是/usr/*下面),安装全局包你最好用root用户操作。
一样,在sudo 或者su下都不行
0
coat
coat

我找到这个解决方案解决了我的问题,只是不理解为什么?


Try

curl https://npmjs.org/install.sh | sudo sh
Take a look at the NPM readme. Your current command is getting (curl) the script as root. You want to run (sh) the script as root.




返回顶部
顶部