我刚刚通过nodejs.org上的软件包安装了node和npm,每当我尝试使用npm搜索或安装某些内容时,它会抛出以下错误,除非我sudo命令.我觉得这是一个权限问题?我已经是管理员了.
npm ERR! Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json'
npm ERR! { [Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/chietala/.npm/-/all/.cache.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "search" "bower"
npm ERR! cwd /Users/chietala
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! path /Users/chietala/.npm/-/all/.cache.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack …Run Code Online (Sandbox Code Playgroud) 我试图建立一个GitHub的jQuery的UI库使用grunt,但运行后npm install我还是根据无法运行该命令自述文件.它只是给出No command 'grunt' found:
james@ubuntu:~/Documents/projects/ad2/lib/jquery-ui$ grunt build
No command 'grunt' found, did you mean:
Command 'grun' from package 'grun' (universe)
grunt: command not found
james@ubuntu:~/Documents/projects/ad2/lib/jquery-ui$ npm ls
jquery-ui@1.9.0pre /home/james/Documents/projects/ad2/lib/jquery-ui
??? grunt@0.3.9
? ??? async@0.1.18
? ??? colors@0.6.0-1
? ??? connect@1.8.7
? ? ??? formidable@1.0.9
? ? ??? mime@1.2.5
? ? ??? qs@0.5.0
? ??? dateformat@1.0.2-1.2.3
? ??? glob-whatev@0.1.6
? ? ??? minimatch@0.2.4
? ? ??? lru-cache@1.0.6
? ??? gzip-js@0.3.1 …Run Code Online (Sandbox Code Playgroud) 我执行时似乎得到了以下内容 npm install bower -g
/usr/local/share/npm/bin/bower -> /usr/local/share/npm/lib/node_modules/bower/bin/bower
bower@0.8.6 /usr/local/share/npm/lib/node_modules/bower
Run Code Online (Sandbox Code Playgroud)
不幸的是,执行任何bower命令都会返回 -bash: bower: command not found
which npm返回/usr/local/bin/npm并运行which node返回/usr/local/bin/node.
在我的项目目录中,我使用以下命令安装了Grunt:
npm install grunt
Run Code Online (Sandbox Code Playgroud)
...之后我在我的项目目录中执行了Grunt服务器,但它给了我命令not found error.
Raj$ grunt server
-bash: grunt: command not found
Run Code Online (Sandbox Code Playgroud)
和:
npm install grunt
npm WARN package.json BID-2.0@0.0.0 No description
npm WARN package.json BID-2.0@0.0.0 No repository field.
npm WARN package.json BID-2.0@0.0.0 No README data
Run Code Online (Sandbox Code Playgroud)
我该如何解决?