0

I 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] Error: Cannot find module 'typescript'
[ng]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ng]     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ng]     at Module.require (internal/modules/cjs/loader.js:637:17)
[ng]     at require (internal/modules/cjs/helpers.js:22:18)
[ng]     at C:\Users\win123\node_modules\@angular\compiler-cli\src\diagnostics\typescript_symbols.js:22:14
[ng]     at C:\Users\win123\node_modules\@angular\compiler-cli\src\diagnostics\typescript_symbols.js:10:17

[ng]     at Object.<anonymous> (C:\Users\win123\node_modules\@angular\compiler-cli\src\diagnostics\typescript_symbols.js:16:3)
[ng]     at Module._compile (internal/modules/cjs/loader.js:689:30)
[ng]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[ng]     at Module.load (internal/modules/cjs/loader.js:599:32)
[ng]     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[ng]     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[ng]     at Module.require (internal/modules/cjs/loader.js:637:17)
[ng]     at require (internal/modules/cjs/helpers.js:22:18)
[ng]     at C:\Users\win123\node_modules\@angular\compiler-cli\index.js:30:32
[ng]     at C:\Users\win123\node_modules\@angular\compiler-cli\index.js:3:17

[ERROR] ng has unexpectedly closed (exit code 1).

Additionally, i also tried

npm install @ionic/app-scripts@latest --save-dev

this command, but it doesn't work.

Can anyone help me with this issue?

UPDATE 1

$ ionic info
[ERROR] Error loading @ionic/angular-toolkit package.json: Error: Cannot find module '@ionic/angular-toolkit/package'
[ERROR] Error loading @angular/cli package.json: Error: Cannot find module '@angular/cli/package'
[ERROR] Error loading @angular-devkit/build-angular package.json: Error: Cannot find module
        '@angular-devkit/build-angular/package'
[ERROR] Error loading @angular-devkit/schematics package.json: Error: Cannot find module
        '@angular-devkit/schematics/package'


Ionic:

   ionic (Ionic CLI)             : 4.7.0
   Ionic Framework               : @ionic/angular 4.0.0-rc.0
   @angular-devkit/build-angular : not installed
   @angular-devkit/schematics    : not installed
   @angular/cli                  : not installed
   @ionic/angular-toolkit        : not installed

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   Android SDK Tools : 25.2.3 (E:\AndroidSDK)
   NodeJS            : v10.14.2 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 7

UPDATE 2

Package.json

{
  "name": "MyApp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.1.4",
    "@angular/cdk": "^7.2.0",
    "@angular/common": "~7.1.4",
    "@angular/core": "~7.1.4",
    "@angular/forms": "~7.1.4",
    "@angular/http": "~7.1.4",
    "@angular/material": "^7.2.0",
    "@angular/platform-browser": "~7.1.4",
    "@angular/platform-browser-dynamic": "~7.1.4",
    "@angular/router": "~7.1.4",
    "@ionic-native/core": "5.0.0-beta.21",
    "@ionic-native/splash-screen": "5.0.0-beta.21",
    "@ionic-native/status-bar": "5.0.0-beta.21",
    "@ionic/angular": "4.0.0-rc.0",
    "@ionic/cli-plugin-ionic-angular": "^1.4.1",
    "@ionic/pro": "2.0.4",
    "@ionic/storage": "^2.2.0",
    "cordova-android": "7.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.3.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "core-js": "^2.5.4",
    "firebase": "^5.7.2",
    "ionic": "^4.7.0",
    "moment": "^2.23.0",
    "ngx-material-timepicker": "^2.11.0",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.11.4",
    "@angular-devkit/build-angular": "~0.11.4",
    "@angular-devkit/core": "~7.1.4",
    "@angular-devkit/schematics": "~7.1.4",
    "@angular/cli": "^7.1.4",
    "@angular/compiler": "~7.1.4",
    "@angular/compiler-cli": "~7.1.4",
    "@angular/language-service": "~7.1.4",
    "@ionic/angular-toolkit": "^1.2.2",
    "@ionic/app-scripts": "^3.2.1",
    "@ionic/lab": "1.0.16",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.12.0",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.12.0",
    "typescript": "^3.2.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      }
    },
    "platforms": [
      "android"
    ]
  }
}
1
  • Comments are not for extended discussion; this conversation has been moved to chat. Commented Jan 8, 2019 at 6:56

1 Answer 1

1

Try to rm -rf node_modules and then npm i

Sign up to request clarification or add additional context in comments.

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.