由于 bootstrap,运行 无法提供服务?
Can't run ng serve because of bootstrap?
我有一个关于 Angular 的奇怪问题,none 我的研究非常有用。
我对此很陌生,开始了一个小项目,我将 bootstrap 添加到我的 Angular 项目中。我遵循了一个程序 (this one),效果很好!
但今天我尝试 运行 npm serve
命令并出现以下错误:Terminal Error img
我真的不明白错误是什么,但发现 agular-cli.json
文件可能是关键,所以这里是重要的部分。
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
我试图用 src/styles.css
替换 styles.css
但它没有用。
最糟糕的是它在 2 或 3 天前工作,而我什么也没做...
您的 bootstrap 样式路径错误。您的 styles
条目应该是:
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
]
我有一个关于 Angular 的奇怪问题,none 我的研究非常有用。
我对此很陌生,开始了一个小项目,我将 bootstrap 添加到我的 Angular 项目中。我遵循了一个程序 (this one),效果很好!
但今天我尝试 运行 npm serve
命令并出现以下错误:Terminal Error img
我真的不明白错误是什么,但发现 agular-cli.json
文件可能是关键,所以这里是重要的部分。
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
我试图用 src/styles.css
替换 styles.css
但它没有用。
最糟糕的是它在 2 或 3 天前工作,而我什么也没做...
您的 bootstrap 样式路径错误。您的 styles
条目应该是:
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
]