2011-04-08 223 views
5

我在一個我經常在本地測試的應用程序中實現了一個npm模塊(稱爲扳手)。這工作總是沒有問題。然後我試圖在我的服務器上安裝扳手。npm模塊已安裝但不可用?

「故宮安裝扳手」如預期,但只要談到做工作「要求(‘扳手’)」,我得到以下錯誤:

> require("wrench") 
Error: Cannot find module 'wrench' 
    at Function._resolveFilename (module.js:320:11) 
    at Function._load (module.js:266:25) 
    at require (module.js:348:19) 
    at [object Context]:1:1 
    at Interface.<anonymous> (repl.js:171:22) 
    at Interface.emit (events.js:64:17) 
    at Interface._onLine (readline.js:153:10) 
    at Interface._line (readline.js:408:8) 
    at Interface._ttyWrite (readline.js:585:14) 
    at ReadStream.<anonymous> (readline.js:73:12) 

如果我跑「故宮LS」我可以看到

[email protected] 

有什麼我在這裏失蹤?

感謝,

埃利亞斯

+1

你使用哪個版本的npm和node.js? – yojimbo87 2011-04-08 18:05:01

回答

7

我相信npm ls顯示了在故宮所有可用的軟件包。要查看已安裝的軟件包,我認爲您應該發出npm ls installed

我:

​​

我發出:

[email protected]:~$ npm install wrench 
npm info it worked if it ends with ok 
npm info using [email protected] 
npm info using [email protected] 
npm info fetch http://registry.npmjs.org/wrench/-/wrench-0.1.0.tgz 
npm info calculating sha1 /home/alfred/local/lib/node/.npm/nvm/0.0.6/package/v0.4.1/lib/node/.npm/.cache/wrench/0.1.0/package.tgz 
npm info shasum 07440ad670068e0e81c8126c4641d1ca73b83557 
npm info preinstall [email protected] 
npm info install [email protected] 
npm info postinstall [email protected] 
npm info preactivate [email protected] 
npm info activate [email protected] 
npm info postactivate [email protected] 
npm info build Success: [email protected] 
npm ok 

[email protected]:~$ node 
> require('wrench') 
{ rmdirSyncRecursive: [Function], 
    copyDirSyncRecursive: [Function], 
    chmodSyncRecursive: [Function] } 
> 

我的建議是使用最新和最偉大的NPM和node.js中,然後再試一次。

+2

您也可以嘗試:** npm list **列出所有已安裝的節點模塊。 – 2012-06-04 08:56:54