2016-10-04 593 views
2

我有一臺運行Ubuntu 16.04的數字海洋虛擬機。我安裝了節點和git。我拉我的回購,並試圖安裝所有的依賴關係。我在項目文件夾中運行npm install。一切都看起來正確安裝。然後我嘗試運行node server.js開始我的應用程序,並且我得到各種各樣的module not found errorsnpm install installs,但node_modules爲空

當我看裏面node_modules,目錄是空的。

任何想法可能發生什麼?

輸出:

[email protected]:~/codetrunk# npm install --save 
npm WARN deprecated [email protected]: This package is no longer maintained 
npm WARN deprecated [email protected]: This package is deprecated. Use Array.isArray. 
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue 
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue 
npm WARN deprecated [email protected]: [email protected]<3.0.0 is no longer maintained. Upgrade to [email protected]^4.0.0. 
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to [email protected]^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. 
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to [email protected]^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. 
Killed   ...]/extract:alt: verb gentlyRm don't care about contents; nuking /root/codetrunk/node_modules/.staging/alt-983484ae/node 
[email protected]:~/codetrunk# ls 
app bower.json config.js gulpfile.js models node_modules package.json public server.js views 
[email protected]:~/codetrunk# cd node_modules/ 
[email protected]:~/codetrunk/node_modules# ls 
[email protected]:~/codetrunk/node_modules# ls 
[email protected]:~/codetrunk/node_modules# 
+0

是不是你所依賴的所有軟件包都被棄用了。也許這就是原因。 –

+0

你有package.json文件嗎?嘗試運行npm init – vincentjp

+0

你有沒有發現任何解決方案? – kbariotis

回答

1

這可能是你的package.json文件不存在或者沒有dependenciesdevDependencies

3

你必須增加從512mb到1gb的液滴記憶,至少安裝npm模塊。然後你可以回到512MB,如果你想。這爲我修好了。

+1

+1你救了我很多麻煩!事實上,日誌中的「Killed」意味着沒有足夠的內存來解包。 – mkaran

+0

謝謝!我從來不會想到這一點。 – Schrockwell

0

另一個不需要增加液滴內存的選項(或者,如果您不在具有該功能的服務器上),則是單獨或以小組手動安裝依賴項。在我的情況下,express是我安裝的最大的軟件包,所以我用npm install express手動安裝了該軟件包,然後運行npm install以獲取其餘的。