【发布时间】:2018-01-08 01:06:30
【问题描述】:
我的 app.module.ts 文件中有以下代码
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {JsonpModule} from '@angular/http';
import {AppComponent} from './app.component';
import {WeatherComponent} from './weather-
widget/component/weather.component';
@NgModule({
imports: [BrowserModule, JsonpModule],
declarations: [AppComponent, WeatherComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
当我添加 import {JsonpModule} from '@angular/http';
我收到以下错误(没有那个导入一切都很好):
(index):25 错误:(SystemJS) 模块“AppModule”导入的意外值“未定义” 错误:模块“AppModule”导入的意外值“未定义” 在评估 (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14331:33) 在 Array.forEach () 在 CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14311:46) 在 RuntimeCompiler._compileComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17063:49) 在 RuntimeCompiler._compileModuleAndComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17001:39) 在 RuntimeCompiler.compileModuleAsync (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16992:23) 在 PlatformRef__._bootstrapModuleWithZone (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6684:29) 在 PlatformRef_.bootstrapModule (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6666:25) 在 Object.eval (http://localhost:3000/app/main.js:5:10) 在评估 (http://localhost:3000/app/main.js:7:4) 评估http://localhost:3000/app/main.js 加载时出错http://localhost:3000/app/main.js 在评估 (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14331:33) 在 Array.forEach () 在 CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14311:46) 在 RuntimeCompiler._compileComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17063:49) 在 RuntimeCompiler._compileModuleAndComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17001:39) 在 RuntimeCompiler.compileModuleAsync (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16992:23) 在 PlatformRef__._bootstrapModuleWithZone (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6684:29) 在 PlatformRef_.bootstrapModule (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6666:25) 在 Object.eval (http://localhost:3000/app/main.js:5:10) 在评估 (http://localhost:3000/app/main.js:7:4) 评估http://localhost:3000/app/main.js 加载时出错http://localhost:3000/app/main.js
我已经阅读了多个关于可能出现的问题的解决方案,但是没有任何成功。任何建议将不胜感激。
【问题讨论】:
标签: angular