2015-06-19 78 views
2

我想我以前安裝過node.js,但從來沒有用過自制軟件做過。今天,我試圖做一個應用程序的演練,但一開始就陷入了困境。我對編程相當陌生,所以我完全困惑於爲什麼我無法實現這個工作。安裝MEAN堆棧:npm -v module.js:338 throw err;錯誤:無法找到模塊'./cache/caching-client.js'

我已經嘗試了很多東西,但似乎無法找到答案。

這些都是我爲了安裝MEAN堆棧運行命令:

  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" (成功的沒有錯誤)
  2. brew install node (succesfull沒有錯誤)
  3. 我檢查,如果節點已安裝正確鍵入: node -v v0.12.4
  4. 然後檢查是否安裝了npm pr operly通過鍵入: npm -v

以下是錯誤消息:在比使用自制軟件,也許這是搞亂的東西了其他不同的方式

module.js:338 
    throw err; 
     ^
Error: Cannot find module './cache/caching-client.js' 
    at Function.Module._resolveFilename (module.js:336:15) 
    at Function.Module._load (module.js:278:25) 
    at Module.require (module.js:365:17) 
    at require (module.js:384:17) 
    at /usr/local/lib/node_modules/npm/lib/npm.js:22:24 
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:466:3) 
    at Module._compile (module.js:460:26) 
    at Object.Module._extensions..js (module.js:478:10) 
    at Module.load (module.js:355:32) 
    at Function.Module._load (module.js:310:12) 

我已經安裝節點。請讓我知道你的想法。

我已經試過到目前爲止做的是卸載節點,並使用此過程重新安裝: https://gist.github.com/DanHerbert/9520689

+0

也許你的$ NODE_PATH是空的,請按照這個[鏈接](http://stackoverflow.com/questions/12594541/npm-global-install-cannot-find-module) –

回答

1

也許你已經固定的,但答案可能爲他人服務。

我嘗試了馬里奧在他的評論中鏈接到的帖子中的內容,但沒有奏效。只是碰巧我的npm安裝在/Users/USERNAME/.node/bin/,所以我在.bash_profile文件中添加了以下行:export PATH =「$ HOME/.node/bin:$ PATH」。

0

在我的情況下,這是由我安裝節點與根,然後與brew(沒有根)。

因此brew升級時無法覆蓋舊的npm文件。

手動刪除舊的節點安裝爲我工作。

相關問題