Shirjeel Ahmed Khan
Shirjeel Ahmed Khan

Reputation: 267

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

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.

Upvotes: 9

Views: 29108

Answers (11)

Thiago Dias
Thiago Dias

Reputation: 1

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

Upvotes: 0

Supriya
Supriya

Reputation: 581

Try installing by running the following command:

npm i -D -E @ionic/app-scripts

Upvotes: 0

Anthony Luo
Anthony Luo

Reputation: 15

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.

Upvotes: 0

P.Brian.Mackey
P.Brian.Mackey

Reputation: 44285

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

Upvotes: 0

Abdullah
Abdullah

Reputation: 2953

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

Upvotes: 18

chotya
chotya

Reputation: 91

Run:

npm update  

that will make everything fine.

Upvotes: 2

user3760548
user3760548

Reputation: 33

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

Upvotes: 2

Kent
Kent

Reputation: 41

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

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

Upvotes: 4

smons
smons

Reputation: 65

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.

Upvotes: 0

tnfaid
tnfaid

Reputation: 71

delete your node_modules folder

Run:

npm install

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

ionic serve -l

Upvotes: 3

deen
deen

Reputation: 2305

Your question's title itself has the answer.

Try to install the following

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

Upvotes: 12

Related Questions