我目前正在开发一个角度4应用程序,我想使用amexio库。(https://github.com/meta-magic/amexio.github.io)。 我安装了bootstrap,需要Tether.js&使用NPM的Popper.js和Font Awesome。 这是我的angular-cli.json样式和脚本
"styles": [
"../node_modules/font-awesome/css/font-awesome.css",
"styles/app.scss",
"styles.css",
"../node_modules/bootstrap/dist/css/bootsrap.css",
"../node_modules/font-awesome/css/font-awsome.min.css"
],
"scripts": [
"../node_modules/chart.js/dist/Chart.js",
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/tether/dist/js/tether.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
]
但是当我做npm开始时我得到了这个错误:
ERROR in multi ./node_modules/font-awesome/css/font-awesome.css ./src/styles/app.scss ./node_modules/bootsrap/dist/css/bootsrap.css
Module not found: Error: Can't resolve 'D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css' in 'D:\workspace\pmnnew\node_modules\@angular\cli\models\webpack-configs'
resolve 'D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css' in 'D:\workspace\pmnnew\node_modules\@angular\cli\models\webpack-configs'
using description file: D:\workspace\pmnnew\node_modules\@angular\cli\package.json (relative path: ./models/webpack-configs)
Field 'browser' doesn't contain a valid alias configuration
after using description file: D:\workspace\pmnnew\node_modules\@angular\cli\package.json (relative path: ./models/webpack-configs)
using description file: D:\workspace\pmnnew\package.json (relative path: ./node_modules/bootsrap/dist/css/bootsrap.css)
no extension
Field 'browser' doesn't contain a valid alias configuration
D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css.js doesn't exist
as directory
D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css doesn't exist
[D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css]
[D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css.ts]
[D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css.js]
[D:\workspace\pmnnew\node_modules\bootsrap\dist\css\bootsrap.css]
@ multi ./node_modules/font-awesome/css/font-awesome.css ./src/styles/app.scss ./node_modules/bootsrap/dist/css/bootsrap.css
答案 0 :(得分:4)
您导入的文件序列错误,这就是错误的原因。请按照提到的顺序进行。
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/font-awesome/css/font-awesome.min.css",
"styles/app.scss",
"styles.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/tether/dist/js/tether.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.js",
"../src/assets/data/prism/prism.js"
],