Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取未知选项:'-p';运行时,纱线构建:prod Angular 6_Javascript_Angular_Yarnpkg_Angular6 - Fatal编程技术网

Javascript 获取未知选项:'-p';运行时,纱线构建:prod Angular 6

Javascript 获取未知选项:'-p';运行时,纱线构建:prod Angular 6,javascript,angular,yarnpkg,angular6,Javascript,Angular,Yarnpkg,Angular6,在过去的两天里,我一直在面对这个问题。我已经将Angular的版本从版本4更新到了版本6,但是在那之后,我无法创建生产版本。像Thread build、Thread dev这样的命令运行良好。但是当我运行纱线构建:prod时,我得到了错误未知选项:'-p'。 我对Angular还很陌生,无法找出哪里出了问题。因此,任何帮助都将不胜感激 Package.json { "name": "nitrogen", "version": "0.0.1", "license": "MIT"

在过去的两天里,我一直在面对这个问题。我已经将Angular的版本从版本4更新到了版本6,但是在那之后,我无法创建生产版本。像Thread build、Thread dev这样的命令运行良好。但是当我运行纱线构建: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",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@types/underscore": "^1.8.8",
    "angular2-text-mask": "^8.0.5",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.7",
    "file-saver": "^1.3.8",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "ng2-file-upload": "^1.3.0",
    "ng2-nvd3": "^2.0.0",
    "ngx-bootstrap": "^1.9.3",
    "ngx-cookie": "^1.0.0",
    "ngx-toastr": "^6.3.0",
    "node-sass": "^4.9.0",
    "raven-js": "^3.26.2",
    "rxjs": "^5.5.11",
    "underscore": "^1.9.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/file-saver": "^1.3.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.112",
    "codelyzer": "~3.2.0",
    "http-server": "^0.10.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.0"
  `}
`}
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "nitrogen": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "nitrogen:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "nitrogen:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "nitrogen:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "nitrogen-e2e": {
      "root": "",
      "sourceRoot": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "nitrogen:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "nitrogen",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "admin",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "admin"
    }
  }
}
yarn build:prod

sed -i '' -e "s|/admin/|http://nitrogen-assets.s3-website.ap-south-1.amazonaws.com/admin/|g" dist/index.html
Environment.ts

// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const environment = {
  production: false,
  envName: 'dev',
  // apiUrl: 'https://sp.ipsator.com:8443/api/v1/',
  // publicUrl: 'https://sp.ipsator.com:8443/api/v1/'
  apiUrl: 'v1/',
  publicUrl: 'v1/',
  stationUrl: 'dqoz1bwts/',
  bankUrl: 'utils/'
};
export const environment = {
  production: true,
  envName: 'prod',
  apiUrl: 'api/v1/',
  publicUrl: 'api/v1/',
  stationUrl: 'dqoz1bwts/',
  bankUrl: 'utils/'
};
环境.产品ts

// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const environment = {
  production: false,
  envName: 'dev',
  // apiUrl: 'https://sp.ipsator.com:8443/api/v1/',
  // publicUrl: 'https://sp.ipsator.com:8443/api/v1/'
  apiUrl: 'v1/',
  publicUrl: 'v1/',
  stationUrl: 'dqoz1bwts/',
  bankUrl: 'utils/'
};
export const environment = {
  production: true,
  envName: 'prod',
  apiUrl: 'api/v1/',
  publicUrl: 'api/v1/',
  stationUrl: 'dqoz1bwts/',
  bankUrl: 'utils/'
};
angular.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",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@types/underscore": "^1.8.8",
    "angular2-text-mask": "^8.0.5",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.7",
    "file-saver": "^1.3.8",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "ng2-file-upload": "^1.3.0",
    "ng2-nvd3": "^2.0.0",
    "ngx-bootstrap": "^1.9.3",
    "ngx-cookie": "^1.0.0",
    "ngx-toastr": "^6.3.0",
    "node-sass": "^4.9.0",
    "raven-js": "^3.26.2",
    "rxjs": "^5.5.11",
    "underscore": "^1.9.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/file-saver": "^1.3.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.112",
    "codelyzer": "~3.2.0",
    "http-server": "^0.10.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.0"
  `}
`}
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "nitrogen": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "nitrogen:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "nitrogen:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "nitrogen:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "nitrogen-e2e": {
      "root": "",
      "sourceRoot": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "nitrogen:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "nitrogen",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "admin",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "admin"
    }
  }
}
yarn build:prod

sed -i '' -e "s|/admin/|http://nitrogen-assets.s3-website.ap-south-1.amazonaws.com/admin/|g" dist/index.html
Stage.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",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@types/underscore": "^1.8.8",
    "angular2-text-mask": "^8.0.5",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.7",
    "file-saver": "^1.3.8",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "ng2-file-upload": "^1.3.0",
    "ng2-nvd3": "^2.0.0",
    "ngx-bootstrap": "^1.9.3",
    "ngx-cookie": "^1.0.0",
    "ngx-toastr": "^6.3.0",
    "node-sass": "^4.9.0",
    "raven-js": "^3.26.2",
    "rxjs": "^5.5.11",
    "underscore": "^1.9.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/file-saver": "^1.3.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.112",
    "codelyzer": "~3.2.0",
    "http-server": "^0.10.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.0"
  `}
`}
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "nitrogen": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "nitrogen:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "nitrogen:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "nitrogen:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "nitrogen-e2e": {
      "root": "",
      "sourceRoot": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "nitrogen:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "nitrogen",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "admin",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "admin"
    }
  }
}
yarn build:prod

sed -i '' -e "s|/admin/|http://nitrogen-assets.s3-website.ap-south-1.amazonaws.com/admin/|g" dist/index.html
错误屏幕截图

tcs--版本

    {
  "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",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@types/underscore": "^1.8.8",
    "angular2-text-mask": "^8.0.5",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.7",
    "file-saver": "^1.3.8",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "ng2-file-upload": "^1.3.0",
    "ng2-nvd3": "^2.0.0",
    "ngx-bootstrap": "^1.9.3",
    "ngx-cookie": "^1.0.0",
    "ngx-toastr": "^6.3.0",
    "node-sass": "^4.9.0",
    "raven-js": "^3.26.2",
    "rxjs": "^5.5.11",
    "underscore": "^1.9.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/file-saver": "^1.3.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.112",
    "codelyzer": "~3.2.0",
    "http-server": "^0.10.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.0"
  `}
`}
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "nitrogen": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "nitrogen:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "nitrogen:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "nitrogen:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ],
            "styles": [
              "node_modules/ngx-toastr/toastr.css",
              "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
              "src/assets/styles/styles.scss"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "nitrogen-e2e": {
      "root": "",
      "sourceRoot": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "nitrogen:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "nitrogen",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "admin",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "admin"
    }
  }
}
yarn build:prod

sed -i '' -e "s|/admin/|http://nitrogen-assets.s3-website.ap-south-1.amazonaws.com/admin/|g" dist/index.html

tcs帮助


好的,那么您没有Typescript。。?请尝试重新安装:

  • $rm-rf/node_模块
  • $npm安装-g typescript
  • $npm安装类型脚本--保存开发人员
  • $npm安装
  • 或者我猜是纱线:

  • $rm-rf/node_模块
  • $warn全局添加类型脚本
  • $spirn add--dev typescript
  • $warn安装
  • 看看这是否有帮助


    (你不是用两条破折号写了
    $ng build--prod

    我也遇到了同样的错误,看起来Angular团队改变了命令的工作方式

    我以前用过这个:

    ng b -prod -e devserver
    
    现在更新的命令是:

    ng b --prod --c devserver
    
    注意-prod改为--prod,-e(或-environment)改为-c(或-configuration)

    希望能有帮助

    其他信息:

    不是tcs--版本它应该是tsc--版本。
    试着使用ng build--prod,正如@mahval所说的

    你能告诉我们当你运行
    tsc--version
    tsc--help
    时你得到了什么吗?我得到了一个错误,我在问题中更新了相同的内容。好的,检查我更新的答案。