简体   繁体   English

在angular 5.2.1生产中,不赞成使用ules \\ bootstrap \\ dist \\ css \\ bootstrap.cssNode#moveTo。 使用容器#追加

[英]In angular 5.2.1 production getting …ules\bootstrap\dist\css\bootstrap.cssNode#moveTo was deprecated. Use Container#append

See below version info and package.json 参见下面的版本信息和package.json

version: 版:

ng-version="5.2.1"

package.json package.json

{
  "name": "experiment",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.1.1",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.1.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "jquery": "^1.12.4",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.5.5",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }
}

commands: 命令:

1) ng build : here I am not getting any warnings 1) ng build :在这里我没有收到任何警告

2) ng build --prod : here I am getting: 2) ng build --prod :在这里我得到:

10% building modules 4/6 modules 2 active 10%建筑模块4/6模块2活动中
...ules\\bootstrap\\dist\\css\\bootstrap.cssNode#moveTo was deprecated. ...不建议使用ules \\ bootstrap \\ dist \\ css \\ bootstrap.cssNode#moveTo。
Use Container#append. 使用Container#append。 Date: 2018-01-23T06:19:48.732Z Hash: 日期:2018-01-23T06:19:48.732Z哈希:
34c92447878ca7d7b148 Time: 150966ms chunk {0} 34c92447878ca7d7b148时间:150966ms块{0}
polyfills.39c2675f132c0f995f11.bundle.js (polyfills) 59.5 kB [initial] polyfills.39c2675f132c0f995f11.bundle.js(polyfills)59.5 kB [初始]
[rendered] chunk {1} main.5222b9447b8051d66fa2.bundle.js (main) 728 kB [呈现]块{1} main.5222b9447b8051d66fa2.bundle.js(主要)728 kB
[initial] [rendered] chunk {2} styles.b635c6f169c366ff5b2f.bundle.css [初始] [渲染]块{2} styles.b635c6f169c366ff5b2f.bundle.css
(styles) 217 kB [initial] [rendered] chunk {3} (样式)217 kB [初始] [渲染]块{3}
inline.676417dc826d752b57e1.bundle.js (inline) 1.45 kB [entry] inline.676417dc826d752b57e1.bundle.js(inline)1.45 kB [entry]
[rendered] [呈现]

I googled, https://github.com/angular/angular-cli/issues/8598 got this, still, i didn't get a solution. 我用谷歌搜索, https://github.com/angular/angular-cli/issues/8598得到了,但是,我没有解决方案。

npm install -g npm-check-updates

This command is to see the package difference and not to fix any issue., I`ll suggest you to delete your node_modules folder and execute this command 该命令是为了查看软件包的区别,而不是要解决任何问题。建议您删除node_modules文件夹并执行此命令

 ncu -u 

and

npm install --save

to update your package.json. 更新您的package.json。 Once done with it, try with 完成后,尝试

ng build --prod

Please update "@angular/cli" to "1.7.3" 请将“ @ angular / cli”更新为“ 1.7.3”

Step 1: npm remove @angular/cli Step 2: npm cache clean --force Step 3: npm install -g @angular/cli@1.7.3 步骤1:npm删除@ angular / cli步骤2:npm缓存清理--force步骤3:npm安装-g @ angular / cli @ 1.7.3

Still stuck then update your package.json with 仍然卡住,然后使用更新您的package.json

"@angular/cli": "1.7.3" and run npm install “ @ angular / cli”:“ 1.7.3”并运行npm install

Tested and working for me 经过测试并为我工作

I resolved by doing RND. 我通过做RND来解决。 And finally got solution by removing deprecated css in my project. 最后,通过在我的项目中删除不推荐使用的CSS来获得解决方案。

For example .section{color:#ddd;} .section{font-size:14px} this is deprecated css and I changed to .section{color:#ddd; font-size:14px} 例如.section{color:#ddd;} .section{font-size:14px}这是不推荐使用的CSS,我改为.section{color:#ddd; font-size:14px} .section{color:#ddd; font-size:14px}

And I customisd my bootstrap css for example I copied css which are all usefull to my project to my style.css. 并且我自定义了引导CSS,例如,我将对我的项目有用的CSS复制到了style.css中。

It's worked for me. 对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM