问题描述
我正在浏览Angular2教程,网址为 https://angular.io/docs/ts/latest/tutorial/toh -pt5.html .一切都很好,一步路由. Visual Studio代码在前03行显示错误:
I am going through the Angular2 tutorial athttps://angular.io/docs/ts/latest/tutorial/toh-pt5.html. All good to step Routing. Visual Studio Code shows the error at first 03 lines:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
为
[ts]
Module '"c:/Users/ktran/Source/Repos/angular2-quickstart-ts/node_modules/@angular/core/index"' has no exported member 'NgModule'.
文件夹node_modules:
folder node_modules:
有什么想法吗?
推荐答案
某些模块只是添加到了新版本的Angular中,因此,如果不进行更新,则无法导入它.
Some modules just get added to the new version of Angular, so if you are not updating, you can not import it.
经过大约半小时的搜索,找到了解决方法:
After about half an hour of search, got a solution:
创建一个新文件夹,并cd到您的文件夹.
Create a new folder and cd to your folder.
在命令行中,输入:
git clone https://github.com/angular/quickstart
cd quickstart
npm install
并将您的旧代码复制到新创建的项目中
And copy your old code to the newly created project
这篇关于Angular2:ngModule,BrowserModule,FormsModule未导出成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!