1

我尝试将我的 angular 2 应用程序升级到 RC5,但在我使用的第三方库之一中遇到了一些错误,所以我决定回到 RC4。我克隆了在 RC4 中成功运行的 repo,运行了 npm install 等,现在当我运行“npm start”时遇到了这个错误:

(index):32 Error: Error: DI Exception
    at NoProviderError.BaseException [as constructor] (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:4472:27)
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:4602:20)
    at new NoProviderError (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:4638:20)
    at ReflectiveInjector_._throwOrNull (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6532:23)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6560:29)
    at ReflectiveInjector_._getByKey (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6523:29)
    at ReflectiveInjector_._getByReflectiveDependency (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6513:25)
    at ReflectiveInjector_._instantiate (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6411:40)
    at ReflectiveInjector_._instantiateProvider (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6382:29)
    at ReflectiveInjector_._new (http://localhost:3000/node_modules/@angular/core//bundles/core.umd.js:6371:25)
Evaluating http://localhost:3000/app/main.js
Error loading http://localhost:3000/app/main.js

我很困惑为什么这在以前起作用时现在不起作用。我的环境中的某些东西必须发生变化才能导致这些问题。这是我的一些设置的样子......

main.ts:

let appProviders = [
  DivisionProposalsService,
  HTTP_PROVIDERS,
  LoggedInUser,
  TimelineService,
  UserService,
  LeadService,
  GeneralInfoService,
  FileService,
  Parameters
]

bootstrap(AppComponent, [
  appProviders,
  appRouterProviders,
  disableDeprecatedForms(),
 provideForms()
])
.catch(err => console.error(err));

app.component.ts:

@Component({
selector: 'my-app',
template: `
  <navigation></navigation>
  <router-outlet></router-outlet>
  <!--<proposal-page></proposal-page>-->
`,
directives: [NavigationComponent, DivisionProposalsComponent, ProposalPageComponent, ROUTER_DIRECTIVES]
})
export class AppComponent {
...

我真的不知道要显示什么其他代码,因为错误太笼统了。

这些 npm install 警告可能与它有关吗?

npm 安装

angular2-quickstart@1.0.0 postinstall C:\test2 typings install

类型警告已于 2016 年 7 月 25 日弃用:“registry:dt/core-js#0.0.0+20160602141332”已弃用(更新、替换或删除)类型警告已于 2016 年 8 月 23 日弃用:“registry:dt/node#6.0 .0+20160621231320" 已弃用(更新、替换或删除)

├── core-js(全局) ├── jasmine(全局) └── node(全局)

npm WARN 可选跳过失败的可选依赖项/chokidar/fsevents:

npm WARN notsup 与您的操作系统或架构不兼容:fsevents@1.0.14

npm WARN @angular/core@2.0.0-rc.5 需要 rxjs@5.0.0-beta.6 的对等点,但没有安装。

npm WARN @angular/http@2.0.0-rc.4 需要 rxjs@5.0.0-beta.6 的对等点,但没有安装。

npm WARN @angular/platform-server@2.0.0-rc.3 需要 @angular/core@2.0.0-rc.3 的对等点,但没有安装。

npm WARN @angular/platform-server@2.0.0-rc.3 需要 @angular/common@2.0.0-rc.3 的对等点,但没有安装。

npm WARN @angular/platform-server@2.0.0-rc.3 需要 @angular/compiler@2.0.0-rc.3 的对等点,但没有安装。

npm WARN @angular/platform-server@2.0.0-rc.3 需要 @angular/platform-b​​rowser@2.0.0-rc.3 的对等点,但没有安装。

npm WARN @angular/router@3.0.0-beta.1 需要 rxjs@5.0.0-beta.6 的对等点,但没有安装。

npm WARN angular2-in-memory-web-api@0.0.11 需要 @angular/core@2.0.0-rc.1 的对等点,但没有安装。

npm WARN angular2-in-memory-web-api@0.0.11 需要 @angular/http@2.0.0-rc.1 的对等点,但没有安装。

npm WARN angular2-in-memory-web-api@0.0.11 需要 rxjs@5.0.0-beta.6 的对等点,但没有安装。

npm WARN angular2-modal@1.1.2 需要 rxjs@5.0.0-beta.6 的对等点,但没有安装。

npm WARN ng2-bootstrap@1.0.24 需要 @angular/common@2.0.0-rc.4 的对等点,但没有安装。

npm WARN ng2-bootstrap@1.0.24 需要 @angular/compiler@2.0.0-rc.4 的对等点,但没有安装。

npm WARN ng2-bootstrap@1.0.24 需要 @angular/core@2.0.0-rc.4 的对等点,但没有安装。

4

0 回答 0