angular2 업그레이드 angular6 과정에서 발생한 문제

8111 단어
오류 1
ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/core' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 10:0-24

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/common' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 11:0-26

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/forms' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 12:0-25

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/http' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 13:0-24

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/router' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 14:0-26

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angularclass/hmr' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 16:0-28

ERROR in ./src/main.browser.ts
Module not found: Error: Can't resolve '@angularclass/hmr' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/main.browser.ts 7:12-40

ERROR in ./src/polyfills.browser.ts
Module not found: Error: Can't resolve 'zone.js/dist/zone' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/polyfills.browser.ts 27:0-28

ERROR in ./src/polyfills.browser.ts
Module not found: Error: Can't resolve 'zone.js/dist/long-stack-trace-zone' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/polyfills.browser.ts 35:4-49

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve 'rxjs/add/operator/map' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 18:0-32

ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve 'rxjs/add/operator/mergeMap' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
 @ ./src/vendor.browser.ts 19:0-37

ERROR in ./src/app/environment.ts
Module not found: Error: Can't resolve '@angular/core' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src\app'
 @ ./src/app/environment.ts 5:13-37
 @ ./src/main.browser.ts

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/core' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src\app'
 @ ./src/app/app.module.ts 2:13-37
 @ ./src/app/index.ts
 @ ./src/main.browser.ts

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/forms' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src\app'
 @ ./src/app/app.module.ts 4:14-39
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
ERROR in [default] 
Cannot find type definition file for 'hammerjs'.

ERROR in [default] 
Cannot find type definition file for 'jasmine'.

ERROR in [default] 
Cannot find type definition file for 'node'.

ERROR in [default] 
Cannot find type definition file for 'protractor'.

ERROR in [default] 
Cannot find type definition file for 'selenium-webdriver'.

해결 방법
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save

사실 업그레이드 과정에서 이 외에도 많은 문제가 발생했습니다. 마지막에 저는 돈의angular/cli를 해제하고 6.0 버전의cli를 다시 설치하여 프로젝트에 대한 의존을 다시 구축했습니다.UI 프레임워크 ng-zorro-antd를 도입했을 때 오류가 발생했습니다. 오류 2
ERROR in ./node_modules/ng-zorro-antd/src/ng-zorro-antd.less (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/less-loader/dist/cjs.js??ref--15-3!./node_modules/ng-zorro-antd/src/ng-zorro-antd.less)
Module build failed:

// https://github.com/ant-design/ant-motion/issues/44
.bezierEasingMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
      in E:\projects\my-project
ode_modules
g-zorro-antd\src\style\color\bezierEasing.less (line 110, column 0)

해결 방법은 @angular/cli 6.0 버전을 구축할 때 less3.0을 다운로드했지만 less3.0은 자바스크립트 Enabled 옵션을 지원하지 않기 때문에 less2.7 버전 오류3로 다운받습니다.
ERROR in node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(11,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(12,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/cdk/overlay/typings/position/connected-position-strategy.d.ts(12,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/cdk/scrolling/typings/scroll-dispatcher.d.ts(10,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Subscription"' has no exported member 'Subscription'.
node_modules/@angular/cdk/scrolling/typings/scroll-dispatcher.d.ts(11,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/cdk/scrolling/typings/scrollable.d.ts(9,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/cdk/scrolling/typings/viewport-ruler.d.ts(10,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/ng-zorro-antd/src/anchor/nz-anchor.component.d.ts(2,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Subscription"' has no exported member 'Subscription'.
node_modules/ng-zorro-antd/src/auto-complete/nz-autocomplete.component.d.ts(2,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/ng-zorro-antd/src/carousel/nz-carousel.component.d.ts(2,10): error TS2305: Module '"E:/projects/my-project/node_modules/rxjs/Subscription"' has no exported member 'Subscription'.

해결 방법은 npm install --save rxjs를 실행해야 합니다 [email protected]상세히 보다https://github.com/NG-ZORRO/ng-zorro-antd/issues/1442rxjs-compat는 rxjs 5와 호환됩니다.x 오류4
npm ERR! path C:\Users\Administrator\AppData\Roaming
pm
g npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall open npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\Administrator\AppData\Roaming
pm
g' npm ERR! { Error: EPERM: operation not permitted, open 'C:\Users\Administrator\AppData\Roaming
pm
g' npm ERR! cause: npm ERR! { Error: EPERM: operation not permitted, open 'C:\Users\Administrator\AppData\Roaming
pm
g' npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'open', npm ERR! path: 'C:\\Users\\Administrator\\AppData\\Roaming\
pm\
g' }, npm ERR! stack: 'Error: EPERM: operation not permitted, open \'C:\\Users\\Administrator\\AppData\\Roaming\
pm\
g\'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'open', npm ERR! path: 'C:\\Users\\Administrator\\AppData\\Roaming\
pm\
g' }

이 오류는angular/cli를 다운로드할 때 발생하는 해결 방법이 관리자로 실행되는지 안 되는지 마지막으로 파라미터를 추가하면 OK npm install-g @angular/cli-no-optiona
마지막으로 같은 업그레이드 과정에서 문제가 발생한 당신에게 어떤 기술 버전을 업그레이드할 때 이 기술의github에 관심을 가져야 한다는 조언을 드립니다.

좋은 웹페이지 즐겨찾기