npm 6.3.0 --only = prod也要安装devDependencies

时间:2018-08-08 18:43:57

标签: npm npm-install

在将npm版本从5.6.0升级到6.3.0之后,--only=prod参数不起作用,并且devDependencies中列出的npm安装软件包也已安装。但是在5.6.0版本中,它可以正常工作。安装过程在根文件夹中没有package-lock.json的情况下进行

节点版本8.11.3 npm版本6.3.0

我正在从事Angular Project。这是package.json文件:

{
  "name": "frontend-skeleton",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "node build",
    "test": "ng test",
    "lint": "ng lint",
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.4.1",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "@types/lodash": "^4.14.115",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.3",
    "hammerjs": "^2.0.8",
    "lodash": "^4.17.10",
    "rxjs": "^6.2.2",
    "rxjs-compat": "^6.2.2",
    "zone.js": "^0.8.20",        
    "@angular-devkit/build-angular": "~0.7.0",
    "@angular/compiler-cli": "^6.1.0",
    "typescript": "2.9.2"
  },
  "devDependencies": {
    "@angular-devkit/core": "^0.7.1",
    "@angular/cli": "6.1.1",    
    "@types/jasmine": "^2.8.4",
    "@types/node": "^10.5.4",
    "codelyzer": "~4.4.3",
    "jasmine-core": "~3.1.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.5",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.3.3",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.2.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1"       
  }
}

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题-运行

NODE_ENV=production npm install

为我工作。