错误InjectionToken AngularFire

时间:2017-06-05 22:32:38

标签: javascript firebase angularfire

你好我在运行服务时遇到这个错误。我按照angularFire文档。

https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md

WARNING in ./~/angularfire2/angularfire2.js
3:26-40 "export 'InjectionToken' was not found in '@angular/core'

WARNING in ./~/angularfire2/app/firebase.app.module.js
3:40-54 "export 'InjectionToken' was not found in '@angular/core'

ERROR in /Users/sebastianalcoser/Documents/web/node_modules/angularfire2/app/firebase.app.module.d.ts (1,10): Module '"/Users/sebastianalcoser/Documents/web/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.

ERROR in /Users/sebastianalcoser/Documents/web/node_modules/angularfire2/angularfire2.d.ts (3,10): Module '"/Users/sebastianalcoser/Documents/web/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.

ERROR in Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'firebaseConfig'. Consider exporting the symbol (position 14:5 in the original .ts file), resolving symbol AppModule in /Users/sebastianalcoser/Documents/web/src/app/app.module.ts

ERROR in multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:4200' in '/Users/sebastianalcoser/Documents/web'
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in multi ./src/styles.css
Module not found: Error: Can't resolve 'css-loader' in '/Users/sebastianalcoser/Documents/web'
 @ multi ./src/styles.css

ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve 'css-loader' in '/Users/sebastianalcoser/Documents/web'
 @ ./src/app/app.component.ts 21:21-51
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

2 个答案:

答案 0 :(得分:1)

要解决此问题,请尝试将节点升级到最新版本8.4,并将angular / cli升级到最新版本,如下所示:

  

确保安装了最新版本的angular-cli。要验证运行命令ng -v并确保您看到angular-cli:1.x.x-beta.xx。最低兼容版本是1.x.x-beta.14。

     

您的cli版本可能错误

npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean

重新安装干净版

npm install -g @angular/cli@latest

您需要Angular CLI,typings和TypeScript。

npm install -g @angular/cli@latest

或本地安装

npm install @angular/cli --save-dev

确保您已安装打字

npm install -g typings
npm install -g typescript

我从这些this tutorial

复制了这个

答案 1 :(得分:-1)

您需要安装最新版本的angular:

在Linux / Mac上: npm install @ angular / {common,compiler,compiler-cli,core,forms,http,platform-b​​rowser,platform-b​​rowser-dynamic,platform-server,router,animations} @latest typescript @ latest --save 在Windows上: npm install @ angular / common @ latest @ angular / compiler @ latest @ angular / compiler-cli @ latest @ angular / core @ latest @ angular / forms @ latest @ angular / http @ latest @ angular / platform-b​​rowser @ latest @angular / platform-b​​rowser-dynamic @ latest @ angular / platform-server @ latest @ angular / router @ latest @ angular / animations @ latest typescript @ latest --save

可能您需要更新polyfill: npm install promise-polyfill --save-exact