[英]Why doesn't Travis CI run “npm install” with NODE_ENV production
I tried to compile my project in Travis CI with the following config: 我尝试使用以下配置在Travis CI中编译我的项目:
language: node_js
node_js:
- 0.12
env:
global:
- NODE_ENV=production
before_install:
# - npm run init
before_script:
# - bower install
# - gulp
# - npm install
script:
- npm install -g bower
- npm install -g gulp
- gulp
- npm run lint
sudo: false
If I set in my config 如果我在配置中设置
- NODE_ENV=production
Then Travis CI will compile my project. 然后Travis CI将编译我的项目。
Travis CI does run npm install
automatically — I suspect the problem you're having is with NODE_ENV
and dependencies
and devDependencies
. Travis CI确实会自动运行
npm install
—我怀疑您遇到的问题是NODE_ENV
以及dependencies
和devDependencies
。
If NODE_ENV=production
, NPM will not install devDependencies
(as noted here: https://github.com/npm/npm/issues/6803 ). 如果
NODE_ENV=production
,则NPM将不会安装devDependencies
(如此处所述: https : //github.com/npm/npm/issues/6803 )。 You need to make sure the dependencies you need are in the correct group: 您需要确保所需的依赖项在正确的组中:
NODE_ENV=production
: dependencies installed from dependencies
group NODE_ENV=production
:从dependencies
组安装的dependencies
NODE_ENV=development
: dependencies installed from devDependencies
group NODE_ENV=development
:从devDependencies
组安装的依赖devDependencies
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.