9

I'm migrating angular application from 5 to 6. Run

ng update @angular/cliand ng update @angular/core

But now if i run ng build, i get this error

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 includes"typescript": ">=2.7.0 <2.8.0" in devDependencies

Cleaned npm cache and reinstalled all packages but it didn't help.

Anybody with same issues?

7
  • Related: stackoverflow.com/questions/44611526/… Commented Jun 14, 2018 at 11:24
  • seems not to be the same .angular-cli.json is not needed anymore. Reinstall didn't help Commented Jun 14, 2018 at 11:35
  • Did you follow all steps in update.angular.io ? Commented Jun 14, 2018 at 11:46
  • yes. Last step - rxjs migration seems not to affect this issue. But i'm not sure Commented Jun 14, 2018 at 11:59
  • I am facing the same issue, did you fix by any chance? Commented Jul 6, 2018 at 10:22

2 Answers 2

17

Reinstall typescript cleanly

- npm uninstall -g typescript
- npm uninstall typescript
- npm install -g typescript
- npm install [email protected]
Sign up to request clarification or add additional context in comments.

Comments

0

I've spent way too much time for this. Due to specific folder structure the problem was with root path inside angular.json. It pointed to .. which was 'outside' of the project instead of root folder.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.