在生产服务器上ng build --prod错误

时间:2018-07-17 07:19:30

标签: angular bootstrap-4 angular5

在生产服务器上运行“ ng build --prod”时出现以下错误。

ERROR in ./node_modules/bootstrap/dist/css/bootstrap.min.css
Module build failed: BrowserslistError: Unknown browser query `dead`
    at /home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/browserslist/index.js:164:11
    at Array.reduce (<anonymous>)
    at resolve (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/browserslist/index.js:132:18)
    at browserslist (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/browserslist/index.js:224:16)
    at Browsers.parse (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/browsers.js:61:16)
    at new Browsers (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/browsers.js:52:30)
    at loadPrefixes (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/autoprefixer.js:70:24)
    at plugin (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/autoprefixer.js:81:24)
    at LazyResult.run (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss/lib/lazy-result.js:277:20)
    at LazyResult.asyncTick (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss/lib/lazy-result.js:192:32)
    at /home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss/lib/lazy-result.js:197:27
    at <anonymous>
ERROR in ./node_modules/bootstrap/dist/css/bootstrap.min.css
Module build failed: ModuleBuildError: Module build failed: BrowserslistError: Unknown browser query `dead`
    at /home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/browserslist/index.js:164:11
    at Array.reduce (<anonymous>)
    at resolve (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/browserslist/index.js:132:18)
    at browserslist (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/browserslist/index.js:224:16)
    at Browsers.parse (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/browsers.js:61:16)
    at new Browsers (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/browsers.js:52:30)
    at loadPrefixes (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/autoprefixer.js:70:24)
    at plugin (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/autoprefixer/lib/autoprefixer.js:81:24)
    at LazyResult.run (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss/lib/lazy-result.js:277:20)
    at LazyResult.asyncTick (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss/lib/lazy-result.js:192:32)
    at /home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss/lib/lazy-result.js:197:27
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at runLoaders (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/@angular/cli/node_modules/webpack/lib/NormalModule.js:195:19)
    at /home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/loader-runner/lib/LoaderRunner.js:230:18
    at context.callback (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Promise.resolve.then.then.catch (/home/ubuntu/jenkins/jenkins_home/workspace/frontend/Pesamill/node_modules/postcss-loader/lib/index.js:194:71)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

我的package.json文件

{
    "name": "pesamill",
    "version": "0.0.0",
    "license": "MIT",
    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build --prod",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
        "@amcharts/amcharts3-angular": "^2.1.1",
        "@angular/animations": "^5.2.0",
        "@angular/common": "^5.2.0",
        "@angular/compiler": "^5.2.0",
        "@angular/core": "^5.2.0",
        "@angular/forms": "^5.2.0",
        "@angular/http": "^5.2.0",
        "@angular/platform-browser": "^5.2.0",
        "@angular/platform-browser-dynamic": "^5.2.0",
        "@angular/router": "^5.2.0",
        "@stomp/ng2-stompjs": "^4.0.0",
        "@types/jquery": "^3.3.1",
        "angular-archwizard": "^3.0.0",
        "angular2-qrcode": "^2.0.1",
        "angular2-toaster": "^5.0.1",
        "angularx-qrcode": "^1.1.0",
        "bootstrap": "^4.0.0",
        "chart.js": "^2.7.2",
        "core-js": "^2.4.1",
        "font-awesome": "^4.7.0",
        "hover.css": "^2.2.1",
        "jquery": "^3.3.1",
        "ng-recaptcha": "^3.0.3",
        "ng2-bootstrap": "^1.6.3",
        "ng2-charts": "^1.6.0",
        "ng2-toastr": "^4.1.2",
        "ng2-validation": "^4.2.0",
        "ngx-bootstrap": "^2.0.3",
        "ngx-clipboard": "^10.0.0",
        "ngx-loading": "^1.0.14",
        "popper.js": "^1.12.9",
        "rxjs": "^5.5.6",
        "sockjs-client": "^1.1.5",
        "stompjs": "^2.3.3",
        "zone.js": "^0.8.19"
    },
    "devDependencies": {
        "@angular/cli": "~1.7.1",
        "@angular/compiler-cli": "^5.2.0",
        "@angular/language-service": "^5.2.0",
        "@types/jasmine": "~2.8.3",
        "@types/jasminewd2": "~2.0.2",
        "@types/node": "~6.0.60",
        "codelyzer": "^4.0.1",
        "jasmine-core": "~2.8.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~2.0.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "^1.2.1",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "protractor": "~5.1.2",
        "ts-node": "~4.1.0",
        "tslint": "~5.9.1",
        "typescript": "~2.5.3",
        "webpack": "^3.8.1"
    }
}

请告诉我如何解决? 经过一些谷歌搜索后,我发现很少有人建议升级引导程序版本或降级angularcli版本来解决此问题,但我不确定该怎么做。 恐怕如果我降级angular-cli可能会破坏应用程序,或者如果升级引导程序则可能会破坏布局。

0 个答案:

没有答案