Bootstrap 4 beta npm 依赖于 ng-bootstrap
Bootstrap 4 beta npm dependency with ng-bootstrap
在 Bootstrap 4 beta 中添加了一个新的依赖项,即 popper.js。如果我将 package.json 中的 npm 依赖项升级到 Bootstrap 4 beta 并将 ng-bootstrap 升级到 1.0.0-beta.5,我会得到 "UNMET PEER DEPENDENCY" for popper.js . (当我调用 npm install 时。)
然而在 website of ng-bootstrap 上写着:
"No, the goal of ng-bootstrap is to completely replace JavaScript implementation for components. Nor should you include other dependencies like jQuery or popper.js. It is not necessary and might interfere with ng-bootstrap code."
所以我不明白这一点。如果我不添加它,我会收到上面写的警告。但是该网站要求我不要添加它。我做错了什么?
我不会用popper,所以如果不需要,我不想把它加到我的依赖中。
我 运行 遇到了同样的问题,即使有记录,也可以更明确...
在ng-bootstrap getting started中写到它依赖于AngularANDBootstrap。因此,您需要在 package.json
中包含 bootstrap 并在 .angular-cli.json
中引用 css/js 文件
但正如所写,在 Bootstrap source documentation 中,bootstrap.min.js
不包括 Popper(bootstrap 要求)。您需要自己导入 Popper 或使用 bootstrap.bundle.min.js
而不是 bootstrap.min.js
这是文件:
package.json :
...
"dependencies": {
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.9",
"bootstrap": "^4.0.0-beta.3",
},
...
app.module.ts :
...
imports: [
...
NgbModule.forRoot()
],
...
.angular-cli.json :
...
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
],
...
在 Bootstrap 4 beta 中添加了一个新的依赖项,即 popper.js。如果我将 package.json 中的 npm 依赖项升级到 Bootstrap 4 beta 并将 ng-bootstrap 升级到 1.0.0-beta.5,我会得到 "UNMET PEER DEPENDENCY" for popper.js . (当我调用 npm install 时。) 然而在 website of ng-bootstrap 上写着:
"No, the goal of ng-bootstrap is to completely replace JavaScript implementation for components. Nor should you include other dependencies like jQuery or popper.js. It is not necessary and might interfere with ng-bootstrap code."
所以我不明白这一点。如果我不添加它,我会收到上面写的警告。但是该网站要求我不要添加它。我做错了什么?
我不会用popper,所以如果不需要,我不想把它加到我的依赖中。
我 运行 遇到了同样的问题,即使有记录,也可以更明确...
在ng-bootstrap getting started中写到它依赖于AngularANDBootstrap。因此,您需要在 package.json
中包含 bootstrap 并在 .angular-cli.json
但正如所写,在 Bootstrap source documentation 中,bootstrap.min.js
不包括 Popper(bootstrap 要求)。您需要自己导入 Popper 或使用 bootstrap.bundle.min.js
而不是 bootstrap.min.js
这是文件:
package.json :
...
"dependencies": {
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.9",
"bootstrap": "^4.0.0-beta.3",
},
...
app.module.ts :
...
imports: [
...
NgbModule.forRoot()
],
...
.angular-cli.json :
...
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
],
...