[Resolved] An unhandled exception occurred: Cannot find module 'typescript' in Angular
Dung Do Tien Sep 09 2020 1409
I have a cms template with angular 9. I downloaded it from the CoreUI website and after installed Node.js and Angular CLI I ran the command below :
ng serve --port 4201 -o
But I got an error as below:
An unhandled exception occurred: Cannot find module 'typescript'
Require stack:
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\commands\serve-impl.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\conta\AppData\Local\Temp\ng-mcuJQV\angular-errors.log" for further details.
I need any suggestions!!
Have 2 answer(s) found.
- S0
Sandeep Kumar Sep 09 2020
You'll need to install
typescript
locally since v8, it's usingrequire.resolve
which has its own separate limitations but is used to resolve a different issue. That meanstypescript
is resolved from where you're running it right now. - S0
Sandeep Kumar Sep 09 2020
I'm not sure what that's working around but run
npm install typescript
command is the "fix" here.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.