[英]npm installing dev dependencies on production
I set NODE_ENV to production and tried to install dependencies using a Capfile which contains this: 我将NODE_ENV设置为生产,并尝试使用包含以下内容的Capfile安装依赖项:
run "cd #{latest_release} && npm config set production=true && npm install --production"
or this: 或这个:
run "cd #{latest_release} && npm install --production"
but I always get also the dev dependencies, which is annoying because after a few releases all the inodes are taken and I cannot create any other files on the deploy machine. 但是我总是也得到dev依赖,这很烦人,因为在发布了几个inode之后,我无法在部署计算机上创建任何其他文件。
I set the environment variable like this in the Capfile: 我在Capfile中这样设置环境变量:
set :default_environment, {
'NODE_ENV' => 'production'
}
run "echo $NODE_ENV"
and it echoes the correct value. 它回显正确的值。
If I execute 如果我执行
npm install --production
from within a shell, it works correctly. 从外壳程序中,它可以正常工作。 The user that makes the capistrano deploy and this shell user are the same, so I'm quite lost.
进行capistrano部署的用户与该shell用户是相同的,所以我很迷路。 Any hints?
有什么提示吗?
The problem was: 问题是:
sudo npm link
which I ran after the install command and which installs all dependencies. 我在install命令之后运行,并安装所有依赖项。 The fix is:
解决方法是:
sudo npm link --production
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.