我有一个我想部署到heroku服务器的角度应用程序, 当triyng将其推送到heroku时,在构建应用程序时会抛出此错误。
> remote: ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--15-3!./src/styles.scss)
remote: Module build failed (from ./node_modules/postcss-loader/src/index.js):
remote: Error: Failed to find 'bootstrap/dist/css/bootstrap.min.css'
remote: in [
remote: /tmp/build_d62dc57294d62a0a94ce724ef0a3a389/src
remote: ]
remote: at resolveModule.catch.catch (/tmp/build_d62dc57294d62a0a94ce724ef0a3a389/node_modules/postcss-import/lib/resolve-id.js:35:13)
remote: @ ./src/styles.scss 1:14-241
remote: @ multi ./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css ./src/styles.scss
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! weather-task@0.0.0 build: `ng build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the weather-task@0.0.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.RIXvs/_logs/2019-12-02T12_55_26_250Z-debug.log
remote:
remote: -----> Build failed
这是我的服务器,应该为页面提供服务:
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static('./dist'));
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname + '/dist/index.html'));
});
console.log(__dirname + '/dist/index.html')
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
和我的package.json及其所有依赖项
{
"name": "weather-task",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/cdk": "~8.2.3",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"hammerjs": "^2.0.8",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.19",
"@angular/cli": "~8.3.19",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
},
"engines": {
"node": "11.0.0",
"npm": "6.11.3"
}
}
im试图弄清楚我的包json中缺少什么以及如何解决它。 有什么建议吗? 谢谢!