错误注入令牌 AngularFire
Error InjectionToken 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
您需要安装最新版本angular:
在 Linux/Mac 上:
npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest typescript@latest --save
在 Windows 上:
npm 安装@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
并且您可能需要更新 polyfill:
npm 安装 promise-polyfill --save-exact
要解决此问题,请尝试将您的节点升级到最新版本 8.4,并将您的 angular/cli 升级到最新版本,如下所示:
make sure you have latest version of angular-cli installed. To verify run the command ng -v and ensure you see angular-cli: 1.x.x-beta.xx. The lowest compatible version is 1.x.x-beta.14.
you may have the wrong cli version
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
重新安装干净版本
npm install -g @angular/cli@latest
您需要 Angular CLI、类型和 TypeScript。
npm install -g @angular/cli@latest
或本地安装
npm install @angular/cli --save-dev
确保你安装了打字
npm install -g typings
npm install -g typescript
我从这些 this tutorial:
中复制了这个
您好,我在 运行 服务时遇到此错误。我遵循 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
您需要安装最新版本angular:
在 Linux/Mac 上: npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest typescript@latest --save 在 Windows 上: npm 安装@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
并且您可能需要更新 polyfill: npm 安装 promise-polyfill --save-exact
要解决此问题,请尝试将您的节点升级到最新版本 8.4,并将您的 angular/cli 升级到最新版本,如下所示:
make sure you have latest version of angular-cli installed. To verify run the command ng -v and ensure you see angular-cli: 1.x.x-beta.xx. The lowest compatible version is 1.x.x-beta.14.
you may have the wrong cli version
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
重新安装干净版本
npm install -g @angular/cli@latest
您需要 Angular CLI、类型和 TypeScript。
npm install -g @angular/cli@latest
或本地安装
npm install @angular/cli --save-dev
确保你安装了打字
npm install -g typings
npm install -g typescript