我从最近两天开始面临这个问题。我已经将Angular的版本从版本4更新到了版本6,但是之后,我无法创建生产版本。纱线构建,纱线开发等命令运行正常。但是,当我运行yarn build:prod时,出现错误未知选项:-p。我对Angular来说还很陌生,无法弄清楚出了什么问题。因此,任何帮助将不胜感激。
Package.json
{
"name": "nitrogen",
"version": "0.0.1",
"license": "MIT",
"scripts": {
"ng": "ng",
"dev": "node --max_old_space_size=8000 ./node_modules/.bin/ng serve --proxy-config proxy.conf.json",
"serve:prod": "yarn build:prod && hs -p 4200 dist/",
"build": "ng build",
"build:dev": "ng build --statsJson",
"build:prod": "ng build -prod -aot --statsJson -d /admin",
"test": "ng test",
"coverage": "ng test --watch false --cc",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0", …Run Code Online (Sandbox Code Playgroud)