2012-12-27 210 views
2

我想沒有連接到網絡的LAN上安裝的node.js。我已經安裝了Node.js的,沒有任何問題,但現在看來,故宮要出門到網上,與NPM私人LAN安裝Node.js的模塊?

http GET https://registry.npmjs.org/moment
所以我不能安裝,我需要的模塊。

這裏是產生的NPM-調試文件:


0 info it worked if it ends with ok 
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', 
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'install', 
1 verbose cli 'moment', 
1 verbose cli '-g' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose node symlink C:\Program Files\nodejs\\node.exe 
5 verbose read json C:\Documents and Settings\User.PALS-DADS\Application Data\npm\package.json 
6 verbose read json C:\Documents and Settings\User.PALS-DADS\Application Data\npm\package.json 
7 verbose cache add [ 'moment', null ] 
8 silly cache add name=undefined spec="moment" args=["moment",null] 
9 verbose parsed url { pathname: 'moment', path: 'moment', href: 'moment' } 
10 silly lockFile b56def36-moment moment 
11 verbose lock moment C:\Documents and Settings\User.PALS-DADS\Application Data\npm-cache\b56def36-moment.lock 
12 silly lockFile b56def36-moment moment 
13 verbose addNamed [ 'moment', '' ] 
14 verbose addNamed [ null, '' ] 
15 silly lockFile 42aa250a-moment [email protected] 
16 verbose lock [email protected] C:\Documents and Settings\User.PALS-DADS\Application Data\npm-cache\42aa250a-moment.lock 
17 silly addNameRange { name: 'moment', range: '', hasData: false } 
18 verbose url raw moment 
19 verbose url resolving [ 'https://registry.npmjs.org/', './moment' ] 
20 verbose url resolved https://registry.npmjs.org/moment 
21 info trying registry request attempt 1 at 16:47:42 
22 http GET https://registry.npmjs.org/moment 
23 info retry will retry, error on last attempt: Error: getaddrinfo ENOENT 
24 info trying registry request attempt 2 at 16:47:52 
25 http GET https://registry.npmjs.org/moment 
26 info retry will retry, error on last attempt: Error: getaddrinfo ENOENT 
27 info trying registry request attempt 3 at 16:48:52 
28 http GET https://registry.npmjs.org/moment 
29 silly lockFile 42aa250a-moment [email protected] 
30 error Error: getaddrinfo ENOENT 
30 error  at errnoException (dns.js:31:11) 
30 error  at Object.onanswer [as oncomplete] (dns.js:123:16) 
31 error If you need help, you may report this log at: 
31 error  
31 error or email it to: 
31 error  
32 error System Windows_NT 5.1.2600 
33 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "moment" "-g" 
34 error cwd C:\Documents and Settings\User.PALS-DADS\Desktop 
35 error node -v v0.8.16 
36 error npm -v 1.1.69 
37 error syscall getaddrinfo 
38 error code ENOTFOUND 
39 error errno ENOTFOUND 
40 verbose exit [ 1, true ] 

如何安裝模塊,無需連接到網絡?

感謝

回答

4

如果你看一看the docs,你會看到,你可以通過傳遞一個文件系統路徑或URL包含您要安裝的包tarball安裝軟件包。

npm install http://server.on.lan/moment.tgz 

當然,如果有問題的軟件包指定了任何依賴關係,npm會嘗試從網絡上獲取它們。此刻沒有任何,所以你應該能夠只需下載壓縮包並安裝它。

但是,如果你要安裝的確實有依賴其他的包,你可能會在局域網上更好setting up a npm registry mirror