Angular 7 安装引导程序 [英] Angular 7 installing bootstrap

查看:29
本文介绍了Angular 7 安装引导程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注应该与 Angular 7 一起使用的Pro Angular 6"一书.我是这样开始项目的;

I'm following the "Pro Angular 6" book which should work with Angular 7. I start the project like so;

安装angular cli

Install angular cli

sudo npm install -g @angular/cli

注意:这里安装了 cli 工具的 7.3.0 版

NOTE: This installed version 7.3.0 of the cli tool

现在安装 TODO 应用

Now install the TODO app

ng new todo
cd todo
ng serve --port 3001 --open

这有效,然后我添加引导程序

This works, then I add in bootstrap

npm install bootstrap@4.1.1

我将以下内容添加到样式中

And I add the following to styles

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

现在,当我为项目提供服务时,出现以下错误;

Now when I serve the project I get the following error;

$ ng serve --port 3001 --open
** Angular Live Development Server is listening on localhost:3001, open your browser on http://localhost:3001/ **

Date: 2019-02-04T00:42:38.279Z
Hash: 3b3bf9a4d6733eee0b6c
Time: 5466ms
chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 5.07 kB [initial] [rendered]
chunk {main} main.js, main.js.map (main) 1.88 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 2.09 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.03 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 327 kB [initial] [rendered]

ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/array' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/date' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/function' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/map' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/math' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/number' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/object' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/parse-float' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/parse-int' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-jit-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/reflect' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/regexp' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/set' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/string' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/symbol' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es2015-polyfills.js
Module not found: Error: Can't resolve 'core-js/es6/weak-map' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js
Module not found: Error: Can't resolve 'core-js/es7/reflect' in '/home/map7/code/pro_angular_6/chap2_prep/todo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models'
ERROR in node_modules/@angular/common/src/location/location.d.ts(8,34): error TS2307: Cannot find module 'rxjs'.
node_modules/@angular/common/src/pipes/async_pipe.d.ts(9,28): error TS2307: Cannot find module 'rxjs'.
node_modules/@angular/core/src/application_ref.d.ts(8,28): error TS2307: Cannot find module 'rxjs'.
node_modules/@angular/core/src/event_emitter.d.ts(8,39): error TS2307: Cannot find module 'rxjs'.
node_modules/@angular/core/src/linker/query_list.d.ts(8,28): error TS2307: Cannot find module 'rxjs'.
node_modules/@angular/core/src/util/lang.d.ts(8,28): error TS2307: Cannot find module 'rxjs'.
src/app/app.component.ts(3,1): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

ℹ 「wdm」: Failed to compile.

推荐答案

我相信你需要将 @angular-devkit/build-angular 作为 dev dependencies 安装在为了解决这个问题

I believe yo need to install @angular-devkit/build-angular as a dev dependencies in order to solve this issue

npm install --save-dev @angular-devkit/build-angular

这篇关于Angular 7 安装引导程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆