bootstrap报错
来源:2-3 搭建环境

明基0
2018-01-25
npm install jquery --save
npm install bootstrap --save
修改.angular-cli.json文件:
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
npm install @types/jquery --save-dev
npm install @types/bootstrap --save-dev
可是代码运行报错,这是怎么回事?
ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/bootstrap/dist/css/bootstrap.css
Module build failed: BrowserslistError: Unknown browser major
at error (C:\Users\xue\Desktop\myjob_router\node_modules\browserslist\index.js:37:11)
at Function.browserslist.checkName (C:\Users\xue\Desktop\myjob_router\node_modules\browserslist\index.js:320:18)
at Function.select (C:\Users\xue\Desktop\myjob_router\node_modules\browserslist\index.js:438:37)
at C:\Users\xue\Desktop\myjob_router\node_modules\browserslist\index.js:207:41
at Array.forEach (<anonymous>)
at browserslist (C:\Users\xue\Desktop\myjob_router\node_modules\browserslist\index.js:196:13)
at Browsers.parse (C:\Users\xue\Desktop\myjob_router\node_modules\autoprefixer\lib\browsers.js:44:14)
at new Browsers (C:\Users\xue\Desktop\myjob_router\node_modules\autoprefixer\lib\browsers.js:39:28)
at loadPrefixes (C:\Users\xue\Desktop\myjob_router\node_modules\autoprefixer\lib\autoprefixer.js:56:18)
at plugin (C:\Users\xue\Desktop\myjob_router\node_modules\autoprefixer\lib\autoprefixer.js:62:18)
at LazyResult.run (C:\Users\xue\Desktop\myjob_router\node_modules\postcss\lib\lazy-result.js:274:20)
at LazyResult.asyncTick (C:\Users\xue\Desktop\myjob_router\node_modules\postcss\lib\lazy-result.js:189:32)
at LazyResult.asyncTick (C:\Users\xue\Desktop\myjob_router\node_modules\postcss\lib\lazy-result.js:201:22)
at processing.Promise.then._this2.processed (C:\Users\xue\Desktop\myjob_router\node_modules\postcss\lib\lazy-result.js:228:20)
at Promise (<anonymous>)
at LazyResult.async (C:\Users\xue\Desktop\myjob_router\node_modules\postcss\lib\lazy-result.js:225:27)
@ ./node_modules/bootstrap/dist/css/bootstrap.css 4:14-123
@ multi ./src/styles.css ./node_modules/bootstrap/dist/css/bootstrap.css
webpack: Failed to compile.
2回答
-
朕的小鱼干捏
2018-01-27
问题出在autoprefixer上,它的版本计较旧。在命令行运行:
npm install postcss-cli autoprefixer
然后就不报错了
但是变形了
012018-01-29 -
taoy
2018-01-26
先到工程里的看看文件夹路径是否正确,也就有没有这些文件夹和文件
node_modules/bootstrap/dist/css/bootstrap.css
感觉还是文件夹路径没有写对,可能你下载的依赖包里面含有一些版本号,会导致文件夹名稍有不同。
022018-01-31
相似问题