I have a VM on digital ocean running Ubuntu 16.04. I installed node and git. I am pulling my repo, and trying to install all dependencies.
我有一个在数字海洋上运行Ubuntu 16.04的VM。我安装了node和git。我正在拖拽我的repo,并试图安装所有依赖项。
I run npm install
inside my project folder. Everything looks to install correctly. Then I try to start my app by running node server.js
and I get all sorts of module not found errors
.
我在我的项目文件夹中运行npm安装。一切看起来都安装正确。然后我尝试通过运行节点服务器来启动我的应用程序。我和js得到各种各样的模块没有找到错误。
When I look inside node_modules
, the directory is empty.
当我查看node_modules内部时,目录是空的。
Any ideas what might be happening?
有什么想法吗?
Output:
输出:
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 个解决方案
#1
3
You have to increase memory of your droplet from 512mb to 1gb, at least for installing the npm modules. Then you can go back to 512mb if you want. That fixed it for me.
您必须将您的droplet的内存从512mb增加到1gb,至少在安装npm模块时是这样。然后你可以回到512mb。这帮我搞定了。
#2
1
It might be that your package.json
file either does not exist or has no dependencies
or devDependencies
.
可能是你的包裹。json文件要么不存在,要么没有依赖项或devDependencies。
#3
0
Another option that doesn't require increasing the memory of your droplet (or, if you're not on a server that has that ability) is to manually install dependencies individually or in small groups. In my case, express was the biggest package I was installing, so I installed that manually with npm install express
, then ran npm install
to get the rest.
另一个不需要增加您的droplet内存(或者,如果您不在具有此功能的服务器上)的选项是单独或在小组中手动安装依赖项。在我的例子中,express是我正在安装的最大的包,所以我用npm install express手工安装了这个包,然后运行npm install来获取其余的包。
#1
3
You have to increase memory of your droplet from 512mb to 1gb, at least for installing the npm modules. Then you can go back to 512mb if you want. That fixed it for me.
您必须将您的droplet的内存从512mb增加到1gb,至少在安装npm模块时是这样。然后你可以回到512mb。这帮我搞定了。
#2
1
It might be that your package.json
file either does not exist or has no dependencies
or devDependencies
.
可能是你的包裹。json文件要么不存在,要么没有依赖项或devDependencies。
#3
0
Another option that doesn't require increasing the memory of your droplet (or, if you're not on a server that has that ability) is to manually install dependencies individually or in small groups. In my case, express was the biggest package I was installing, so I installed that manually with npm install express
, then ran npm install
to get the rest.
另一个不需要增加您的droplet内存(或者,如果您不在具有此功能的服务器上)的选项是单独或在小组中手动安装依赖项。在我的例子中,express是我正在安装的最大的包,所以我用npm install express手工安装了这个包,然后运行npm install来获取其余的包。