6

I have installed npm 3.10.10 then i have installed ionic 3.9.2 and cordova 7.0.1.

i have tried the following steps:

  1. ionic start newProject

    (selected a tabs project)

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

  1. ionic serve

this command will throw the error

Error: Cannot find module 'E:\firstProject\node_modules\@ionic\app-scripts'

i found only this thread Error: Cannot find module '@ionic/app-scripts'.

i don't want to downgrade my nodejs version,as i want to use latest feature

but i tried,

npm i @ionic/app-scripts (SAG Answer)

i'm getting same error after executing above command

please help me without downgrading nodejs version

EDIT 1 (as per sampath suggestion) : below is my package.json file

{
  "name": "firstProject",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/core": "3.12.1",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "3.12.1",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.6.0",
    "ionicons": "3.0.0",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@ionic/app-scripts": "2.1.4",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project"
}

when i run ionic info it is giving some kind of error

$ ionic info

enter image description here

EDIT 2: (After sampath Answer)

  1. i did the following changes
i removed `"@ionic/app-scripts": "2.1.4"`
  1. $ npm install @ionic/app-scripts@latest --save-dev

enter image description here

enter image description here

enter image description here

post $ npm install @ionic/app-scripts@latest --save-dev , package.json file will look like below

enter image description here

please help me thanks in advance!!!!

6 Answers6

8

Guys i solved this issue. Just want to share with you to save your time at least. Follow steps.

  1. Remove node_modules.
  2. Downgrade Node to version 6 (run npm install node@6 or brew install node@6)
  3. Add "@ionic/app-scripts": "3.1.9" under dependencies in project.json
  4. npm i
Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156
  • 1
    After struggling with this issue for very long finally, this solution worked. – Raghav Jun 06 '18 at 15:19
  • @Muhammed: i got above error :after :npm install node@6 but i got above error:npm ERR! node@6.17.1 preinstall: `node installArchSpecificPackage`? – Kapil Soni Apr 22 '19 at 10:33
6

Remove "@ionic/app-scripts": "2.1.4" from your package.json file firstly.

According to your ionic info, you have a problem with app-scripts.So you can install latest as shown below.

and after that compile:

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

Remove "@ionic/app-scripts": "2.1.4" from your package.json file firstly.

Update from Git

Running on Windows you might try:

  1. Set environment in local command window and verify problem:

    set OPENSSL_CONF=c:\dummy
    npm -v

=> you now probably see this ssl error message

  1. Remove environment and verify problem is gone:

    set OPENSSL_CONF=npm -v

=> no ssl error message

noam aghai
  • 1,364
  • 3
  • 18
  • 30
Sampath
  • 63,341
  • 64
  • 307
  • 441
  • hi sampath, i'm still getting the same `error` after following your steps. please look into that, thanks in advance –  Sep 03 '17 at 10:58
  • Do you have the internet on your machine? – Sampath Sep 03 '17 at 11:07
  • yes i do have i'm able install the `npm install @ionic/app-scripts@latest --save-dev` the package –  Sep 03 '17 at 11:10
  • Can you try **Update** section above? See the git issue too. – Sampath Sep 03 '17 at 11:17
  • your above update is working, therefore im not getting any junk message in `cosole` . does this solve my original problem? –  Sep 03 '17 at 11:27
  • OK. You need to run it again the script CLI and see whether is that updated properly on `json` file? – Sampath Sep 03 '17 at 11:29
5

Only install the latest version of @ionic/app-scripts

npm install @ionic/app-scripts@latest --save-dev
Ananta Prasad
  • 3,655
  • 3
  • 23
  • 35
4

Run:

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

to install app-script.

Then:

npm install

To install node_modules to avoid Typescript error

And it worked for me.

Brett DeWoody
  • 59,771
  • 29
  • 135
  • 184
Adham Amiin
  • 809
  • 7
  • 5
0

try deleting node_modules folder and do npm install again this might solve your problem

ganesh
  • 2,024
  • 16
  • 17
  • i have tried this but getting same `error` when i execute `ionic serve` the error is `Error: Cannot find module 'E:\firstProject\node_modules\@ionic\app-scripts` –  Sep 03 '17 at 07:49
  • i think you should try reinstalling ionic `npm uninstall ionic -g ` then `npm install ionic -g` – ganesh Sep 03 '17 at 08:03
  • i have tried that but still same `error`. please help me if have any further solution –  Sep 03 '17 at 09:02
0

I had the same error. I tried update npm , reinstall app-script. I uninstalled node and npm, and then installed again and work it. I think that error was because the version of npm instaltion was diferent to the original instalation of node