npm install installs,但node_modules为空

时间:2016-10-04 01:56:47

标签: node.js npm ubuntu-16.04

我在运行Ubuntu 16.04的数字海洋上有一台虚拟机。我安装了node和git。我正在拉回我的仓库,并尝试安装所有依赖项。

我在项目文件夹中运行npm install。一切看起来都正确安装。然后我尝试通过运行node server.js来启动我的应用,并获得各种module not found errors

当我查看node_modules时,目录为空。

任何想法可能会发生什么?

输出:

root@codetrunk-dev:~/codetrunk# npm install --save
npm WARN deprecated swig@1.4.2: This package is no longer maintained
npm WARN deprecated lodash.isarray@4.0.0: This package is deprecated. Use Array.isArray.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^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
root@codetrunk-dev:~/codetrunk# ls
app  bower.json  config.js  gulpfile.js  models  node_modules  package.json  public  server.js  views
root@codetrunk-dev:~/codetrunk# cd node_modules/
root@codetrunk-dev:~/codetrunk/node_modules# ls
root@codetrunk-dev:~/codetrunk/node_modules# ls
root@codetrunk-dev:~/codetrunk/node_modules#

3 个答案:

答案 0 :(得分:4)

您必须将Droplet的内存从512mb增加到1gb,至少在安装npm模块时是这样。然后,如果你愿意,你可以回到512mb。这为我解决了。

答案 1 :(得分:1)

可能是您的public class TailRecursiveOddonacci { public long tailOddonacci(int n) { if (n <= 3) { return 1; } return tailOddonacciRecursion(0, 1, 2, n); } private long tailOddonacciRecursion(int a, int b, int c, int count) { if(count <= 0) { return a; } return tailOddonacciRecursion(b, a+b, a+b+c, count-1); } } 文件不存在或没有package.jsondependencies

答案 2 :(得分:0)

另一个不需要增加Droplet内存的选项(或者,如果您不在具有该功能的服务器上),则需要单独或以小组手动安装依赖项。在我的情况下,express是我正在安装的最大包,所以我用npm install express手动安装,然后运行npm install来完成剩下的工作。