我正在将角度应用程序从5迁移到6.运行
ng update @ angular / cliand ng update @ angular / core
但是现在如果我运行构建,我会收到此错误
Cannot find module 'typescript' from 'C:\..\App' Error: Cannot find module 'typescript' from 'C:\..\App' at Function.module.exports [as sync] (C:\..\App\MyApp\node_modules\resolve\lib\sync.js:42:15) at resolveProjectModule (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\angular-cli-files\utilities\require-project-module.js:15:20) at Object.requireProjectModule (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\angular-cli-files\utilities\require-project-module.js:20:20) at BrowserBuilder.buildWebpackConfig (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\browser\index.js:103:52) at Observable.rxjs_1.Observable.obs [as _subscribe] (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\browser\index.js:35:38) at Observable._trySubscribe (C:\..\App\MyApp\node_modules\rxjs\internal\Observable.js:43:25) at Observable.subscribe (C:\..\App\MyApp\node_modules\rxjs\internal\Observable.js:29:22) at C:\..\App\MyApp\node_modules\rxjs\internal\util\subscribeTo.js:22:31 at Object.subscribeToResult (C:\..\App\MyApp\node_modules\rxjs\internal\util\subscribeToResult.js:7:45) at MergeMapSubscriber._innerSub (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:75:38) at MergeMapSubscriber._tryNext (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:72:14) at MergeMapSubscriber._next (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:55:18) at MergeMapSubscriber.Subscriber.next (C:\..\App\MyApp\node_modules\rxjs\internal\Subscriber.js:64:18) at TapSubscriber._next (C:\..\App\MyApp\node_modules\rxjs\internal\operators\tap.js:62:26) at TapSubscriber.Subscriber.next (C:\..\App\MyApp\node_modules\rxjs\internal\Subscriber.js:64:18) at MergeMapSubscriber.notifyNext (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
package.json在devDependencies中包含“typescript”:“> = 2.7.0< 2.8.0” 清理npm缓存并重新安装所有软件包,但它没有帮助. 有同样问题的人吗?
干净地重新安装打字稿
原文链接:https://www.f2er.com/angularjs/240339.html- npm uninstall -g typescript - npm uninstall typescript - npm install -g typescript - npm install typescript@2.7.2