2017-07-02 111 views
1

我得到以下错误:Angular4 /打字稿/自举 - 不能编译

ERROR in multi ./node-modules/bootstrap/dist/css/bootstrap.min.css ./src/styles.css Module not found: Error: Can't resolve

Module not found: Error: Can't resolve '/Users/hansdeschinkel/VSCode/Resto/node-modules/bootstrap/dist/css/bootstrap.css' in '/Users/hansdeschinkel/VSCode/Resto/node_modules/@angular/cli/models/webpack-configs'

"styles": [ 
    "../node-modules/bootstrap/dist/css/bootstrap.min.css", 
    "styles.css" 
    ], 

我在node_modules保存引导3.3.7。 我也把它添加到我的angular/cli.json文件夹: 我使用VSCode

+0

你可以把angular-cli.json代码放在​​这里吗?问题是样式需要一个与index.html相关的路径 – Gary

+0

您确定引导程序包在'node_modules'文件夹中 – Aravind

回答

1

如果您styels.css在src文件夹并bootstrap.min.css在node_modules文件夹,然后更改代码,如下所示:

styles: [ 
     'node_modules/bootstrap/dist/css/bootstrap.css', 
     'src/styles.css' 
] 

在角CLI渲染css文件给绝对路径不是相对路径。