last day (16 days later) » 

6:56 AM
0
Q: Cannot find module 'typescript' | Ionic 4

Jaydip KalkaniI pull the ionic 4 code from git to my pc and tried to run it and it shows "Cannot find module 'typescript'" even I installed it already by using npm install typescript and also installed globally by npm install -g typescript Error log: [ng] Cannot find module 'typescript' [ng] Erro...

 
check the node_modules folder. delete it, then run npm install
 
@BSeitkazin already tried this but it doesn't worked.
 
to be sure, is typescript inside package.json?
 
@BSeitkazin yes it's there. "typescript": "^3.1.6"
 
hmm, try to run in your project folder - npm install @ionic/app-scripts @ionic/cli-plugin-ionic-angular ionic typescript. also, look at info, running ionic info
 
6:56 AM
@BSeitkazin Please look at updated question. Added ionic info output.
 
1. delete node_modules, 2. delete package-lock.json , 3. npm install
 
have you installed angular-cli? npm install --save-dev @angular/cli@latest
 
@BSeitkazin Yes, already have installed it but still it's showing this error.
@JohnVelasquez i followed steps that you send but still facing same error.
 
hmm, I think the problem with versioning of libraries. please, put the package.json file
 
post your package.json here
 
6:56 AM
@BSeitkazin Take a look at updated question
@JohnVelasquez Take a look at updated question
 
try to install latest version of angular, instead of angular 4.
 
@OmurbekKadyrbekov tried but still not working.
@BSeitkazin did you found any issue with package.json?
@JohnVelasquez did you found any issue with package.json?
 
nope, everything is fine. the last attempt is, some magic with PC, try to restart your terminal, if it is not working, restart your PC:)
 
:) I am trying to solve this from 2 days and in this time I restarted pc and cmd too many times. It didn't work. Thanks for the help.
 
can you send repository url if it is public?
 
6:56 AM
@OmurbekKadyrbekov It's not public buddy. So i can't share it. I can share my TeamViewer if you have time.
 
i see nothing wrong with your package.json, try removing the caret ^ and tilde ~ on every @ionic and @angular dependencies, then return back to the steps i given you above
 
@JohnVelasquez I did the same. Removed all caret and tilde and followed steps again but still facing same error. It's strange behaviour because same code is working on my friends pc and not working on mine.
 
type npm ls typescript and tell me what is the output
 
@JohnVelasquez Output is ` MyApp@0.0.1 pathofmyproject\MyApp -- (empty)
 
oh okay so typescript is not installed, its weird you have typescript in your package.json but still not installed in your node_modules
 
7:05 AM
Do you know any way to solve it?
@JohnVelasquez
 
i'll try using your package.json and come back to you
 
Thanks buddy
 
weird its working on my side, what node version do your friends is using?
 
7:21 AM
we both are using same version 10.15.0 and npm version 6.4.1
 
what is the output for which tsc? and tsc --version
also ng --version
 
let me check it and paste outputs here
 
i'm not installing typescript globally, so i cannot use tsc
 
hi buddy,
getting too many errors while running tsc....can you please check them by teamviewer?
 
@JaydipKalkani you see, you some errors in your angular cli
I am at work). can not check it now(
 
7:28 AM
ops
 
I suggest you to uninstall angular
 
try doing uninstall on your cli, npm uninstall -g @angular/cli
 
and fresh install cli, tsc
 
ok...thanks buddy. I will try it
 
then install again, npm install -g @angular/cli@7.1.4
before installing, use npm cache clean --force then install
 
7:30 AM
ok...
will be back with the results :)
 
just in case. My ionic -info looks like below.
okadyrbekov@okadyrbekov:~/ionic4/amanatroad$ ionic info

Ionic:

   ionic (Ionic CLI)             : 4.6.0 (/home/okadyrbekov/.nvm/versions/node/v8.9.4/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.17
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.0.7
   @angular/cli                  : 7.0.7
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
okadyrbekov@okadyrbekov:~/ionic4/amanatroad$ which tsc
/home/okadyrbekov/.nvm/versions/node/v8.9.4/bin/tsc
okadyrbekov@okadyrbekov:~/ionic4/amanatroad$ tsc --version
Version 3.1.3
okadyrbekov@okadyrbekov:~/ionic4/amanatroad$ ng --version

_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
 
ok
@OmurbekKadyrbekov still getting errors...
 
try to downgrade your node to version 8, and before that delete the cache folders located in C:\Users\{User}\AppData\Roaming\npm and C:\Users\{User}\AppData\Roaming\npm-cache
 

  last day (16 days later) »