2013-03-16 234 views
21

我在安裝grunt-cli後遇到問題。我跑嘗試運行grunt時找不到模塊'findup-sync'

npm install -g grunt-cli 

然後運行咕嚕錯誤與

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 

這是我已經安裝:

[email protected]:~$ npm list -g 
/home/tmartin/lib 
└─┬ [email protected] 
    ├─┬ [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ └── [email protected] 
    └─┬ [email protected] 
    └── [email protected] 
+3

我有這個問題,因爲我安裝了這個'npm install -g grunt grunt-cli'的grunt-cli和grunt。 grunt-cli需要在grunt之前安裝,所以它應該是'npm install -g grunt-cli grunt' – davidcondrey 2015-06-03 18:13:46

+0

我有一個非常類似的錯誤,並且切換npm install的順序也爲我做了。 – 2015-11-02 18:03:07

回答

7

我必須安裝和連接findup同步等少數NPM包讓這些依賴性問題消失。我雖然npm應該爲我們處理它們,但手動安裝依賴關係使問題消失。

npm install findup-sync -g

npm link findup-sync

+1

你會認爲這將基於錯誤工作,但實際上我已經在適當的地方找到了同步文件。我再次運行這個,但仍然是相同的錯誤。 FWIW我在OS X上遇到了這個問題。可能是Node或者Grunt發行版錯誤。 – 2014-09-26 23:12:10

2

這是因爲故宮不正確的權限設置爲子目錄node_modules在/ usr/lib中/ node_modules /咕嚕-CLI。 就我而言,我有:

drwxr-x--- 6 nobody root 4096 16 févr. 17:08 node_modules 

當運行咕嚕非root用戶,我有同樣的錯誤(找不到模塊「findup同步」),因爲拒絕這個目錄讀取權限。

解決的辦法是使用chmod修復權限:chmod a + rx node_modules。

但事實上,所有的目錄都涉及到。最好的辦法是待辦事項:

find /usr/lib/node_modules/grunt-cli -type d -exec chmod a+rx {} \; 

這可能是一個分發bug(我使用Archlinux)。

4

我得到了我的運行再次重新安裝grunt-cli全球和我的回購。

npm install -g grunt-cli

cd myrepo

npm install grunt-cli

我認爲,優山美地安裝在我的文件,打破了一些東西......

1

這看似簡單,但如果有其他人是否一個不確定權限問題,請嘗試運行sudo grunt然後從那裏開始。

相關問題