ReactiveX / rxjs-tslint

TSLint rules targeting RxJS
MIT License
309 stars 41 forks source link

Error: Cannot find module 'typescript' #50

Closed fkolar closed 6 years ago

fkolar commented 6 years ago

Following angular 5 - 6 upgrade guide, I cannot run:

rxjs-5-to-6-migrate -p src/tsconfig.app.json as it throws error:

Running the automatic migrations. Please, be patient and wait until the execution completes.
module.js:538
    throw err;
    ^

Error: Cannot find module 'typescript'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/i304804/.nvm/versions/node/v8.9.1/lib/node_modules/rxjs-tslint/node_modules/tslint/lib/linter.js:22:10)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
child_process.js:644

Error: Command failed: "/Users/i304804/.nvm/versions/node/v8.9.1/lib/node_modules/rxjs-tslint/node_modules/.bin/tslint" -c "/Users/i304804/.nvm/versions/node/v8.9.1/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.json" -p "src/tsconfig.app.json" --fix
module.js:538
    throw err;
    ^

My env:

Angular CLI: 6.0.8
Node: 8.9.1
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.1
typescript                        2.7.2
webpack                           4.8.3

The ng build runs fine.

fkolar commented 6 years ago

I passed this error. It required typescript to be installed globally.

pradit005 commented 5 years ago

I passed this error. It required typescript to be installed globally.

Hi @fkolar ,

I tried executng this command "npm install -g typescript", which installs typescript globally, but again when I tried to run "ng serve" I am getting the same error.

stuckata commented 5 years ago

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

as697 commented 5 years ago

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yeah this worked for me! Thanks

Vegam-Vijesh commented 4 years ago

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

sarad26 commented 4 years ago

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Vegam-Vijesh commented 4 years ago

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

sarad26 commented 4 years ago

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

sarad26 commented 4 years ago

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

firstsynchs-MBP:routingAnimation firstsynch$ npm install -g typescript /usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc /usr/local/bin/tsserver -> /usr/local/lib/node_modules/typescript/bin/tsserver

npm ERR! A complete log of this run can be found in: npm ERR! /Users/firstsynch/.npm/_logs/2020-05-21T06_38_06_933Z-debug.log firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-9L7YAI/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

Vegam-Vijesh commented 4 years ago

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

Can you check the typescript folder available in "\node_modules\" under your project folder.

sarad26 commented 4 years ago

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

Can you check the typescript folder available in "\node_modules" under your project folder.

Yes, Don't Have, What I should..

Vegam-Vijesh commented 4 years ago

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

Can you check the typescript folder available in "\node_modules" under your project folder.

Yes, Don't Have, What I should..

If you run "npm install" under your project folder it should work. If not you may need to uninstall first then install it again.

sarad26 commented 4 years ago

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

Yes this worked for me

Did not work for me, Please give me any other solution..

Can you please provide your error message.

firstsynchs-MBP:routingAnimation firstsynch$ ng serve -o An unhandled exception occurred: Cannot find module 'typescript' See "/private/var/folders/s5/yt8gds7j4bq3whfjv4hdm6xw0000gn/T/ng-wSJLUt/angular-errors.log" for further details. firstsynchs-MBP:routingAnimation firstsynch$

Can you check the typescript folder available in "\node_modules" under your project folder.

Yes, Don't Have, What I should..

If you run "npm install" under your project folder it should work. If not you may need to uninstall first then install it again.

Ok, Thanks a lot

ahmedynah commented 4 years ago

As I also had the same error even after "npm install -g typescript" I found this solution to work for me: Inside the project dir run "npm install".

@stuckata Thanks a lot. It worked for me, too. But do you know why this command worked while the other didn't?