2016-10-04 84 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以获取其余的。