grunt-cli安装后我无法运行.我跑
npm install -g grunt-cli
Run Code Online (Sandbox Code Playgroud)
然后运行grunt错误
node.js:63
throw e;
^
Error: Cannot find module 'findup-sync'
at loadModule (node.js:275:15)
at require (node.js:411:14)
at Object.<anonymous> (/home/tmartin/bin/grunt:9:14)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:522:24)
at Array.<anonymous> (node.js:756:12)
at EventEmitter._tickCallback (node.js:55:22)
at node.js:773:9
Run Code Online (Sandbox Code Playgroud)
这是我安装的:
tmartin@timcomp:~$ npm list -g
/home/tmartin/lib
??? grunt-cli@0.1.6
??? findup-sync@0.1.2
? ??? glob@3.1.21
? ? ??? graceful-fs@1.2.0
? ? ??? inherits@1.0.0
? ? ??? minimatch@0.2.11
? ? ??? lru-cache@2.2.2
? ? ??? sigmund@1.0.0
? ??? lodash@1.0.1
??? nopt@1.0.10
??? abbrev@1.0.4
Run Code Online (Sandbox Code Playgroud)
Mat*_*ler 12
我不得不安装并链接findup-sync和其他一些npm软件包来解决这些依赖性问题.我虽然npm应该为我们处理它们,但是手动安装依赖项会使问题消失.
npm install findup-sync -g
npm link findup-sync
Xav*_*aut 10
我让我再次运行全局和我的仓库重新安装grunt-cli.
npm install -g grunt-cli
cd myrepo
npm install grunt-cli
我认为Yosemite安装在我的文件中打破了一些东西......
小智 5
这是因为npm没有为/ usr / lib / node_modules / grunt-cli中的子目录node_modules设置正确的权限。就我而言,我有:
drwxr-x--- 6 nobody root 4096 16 févr. 17:08 node_modules
Run Code Online (Sandbox Code Playgroud)
当以非root用户身份运行grunt时,由于拒绝读取该目录的权限,我遇到了相同的错误(找不到模块'findup-sync')。
解决方案是使用chmod修复权限:chmod a + rx node_modules。
但实际上,所有目录都涉及到。最好的方法是:
find /usr/lib/node_modules/grunt-cli -type d -exec chmod a+rx {} \;
Run Code Online (Sandbox Code Playgroud)
这可能是一个发行错误(我使用Archlinux)。
| 归档时间: |
|
| 查看次数: |
17740 次 |
| 最近记录: |