9

I have cloned the my old project and run npm install and after that i run ionic serve

And i found this error

[ERROR] @ionic/app-scripts is required for ionic serve to work properly.

Looks like @ionic/app-scripts isn't installed in this project.

This package is required for ionic serve in ionic/angular 4 projects.
Shirjeel Ahmed Khan
  • 257
  • 1
  • 5
  • 12

11 Answers11

18

enter image description here

To solve the above issue following below commands :

  • npm install --rebuild
  • npm install node-sass --rebuild
  • npm install @ionic/app-scripts@latest --save
Pierre.Vriens
  • 2,117
  • 75
  • 29
  • 42
Abdullah
  • 2,393
  • 1
  • 16
  • 29
  • 1
    Hi @Garry - as per the my understanding, some of the version does not match with the current app-script files, thus first we rebuild the npm, then after we rebuild the node-sass because of it install or modify the current package.json files and in last step we install latest app-script file – Abdullah Aug 28 '18 at 11:05
  • @Pierre.Vriens sorry but solution is more important then focus on other things – Abdullah Aug 28 '18 at 11:07
  • 2
    should be --save-dev for `app-scripts` to not be included in the production bundle – ciekawy Feb 13 '19 at 14:11
12

Your question's title itself has the answer.

Try to install the following

npm install @ionic/app-scripts@latest --save-dev
deen
  • 2,185
  • 7
  • 29
  • 53
4

I ran into this after updating to Ionic 4. I ended up having to downgrade.

https://github.com/ionic-team/ionic-cli/issues/3399

Kent
  • 41
  • 1
3

delete your node_modules folder

Run:

npm install

wait until it finishes. Now you could run your project with:

ionic serve -l
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
tnfaid
  • 61
  • 4
2

Exit the command panel and reopen again. then its works.

user3760548
  • 33
  • 1
  • 5
2

Run:

npm update  

that will make everything fine.

chotya
  • 91
  • 5
0

In addition to deleting node_modules and running npm install as mentioned by @tnfaid, I also deleted package-lock.json file just to be sure. Also ran npm audit fix, to resolve any vulnerabilities. This worked for me.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
smons
  • 65
  • 1
  • 6
0

This happened to me when I upgraded from Ionic 3 to 4. The problem is that package.json and ionic.config.json both changed from 3 to 4. So when you do your copy-paste actions you have to be careful.

Ionic.config.json type should be angular (used to be "type": "ionic-angular")

{
  "name": "myProjectName",
  "integrations": {
    "cordova": {}
  },
  "type": "angular"
}

package.json scripts now follow angular style

You may have had something like this

"scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint --bailOnLintError true",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "ionic:watch:before": "node ./bin/pre-build.js",
    "ionic:build:before": "node ./bin/pre-build.js"
},

That should now changed to standard angular in Ionic 4:

  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
0

In package.json

"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"
  }

delete '"ionic:serve": "ionic-app-scripts serve"', save it and execute ionic serve. It should work now. After that, you can add "ionic:serve": "ionic-app-scripts serve" back.

0

Try installing by running the following command:

npm i -D -E @ionic/app-scripts
SuleymanSah
  • 17,153
  • 5
  • 33
  • 54
Supriya
  • 481
  • 5
  • 5
0

After some research I found out that it was a permission problem.

In my case I solved it in a different way. I had to change permission and then update

sudo chown -R thiagodias:thiagodias /Documents/ionic_workspace
:~/Documents/ionic_workspace/test$ sudo npm install @ionic/app-scripts@latest
geisterfurz007
  • 5,292
  • 5
  • 33
  • 54