离子服务正常工作需要ERROR @ ionic / app-scripts

问题描述 投票:4回答:8

我克隆了我的旧项目并运行npm install,之后我运行ionic serve

我发现了这个错误

[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.
angular ionic-framework ionic2 ionic3
8个回答
12
投票

enter image description here

要按照以下命令解决上述问题:

  • npm install --rebuild
  • npm install node-sass --rebuild
  • npm install @ ionic / app-scripts @ latest --save

7
投票

你的问题标题本身就有答案。

尝试安装以下内容

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

3
投票

删除node_modules文件夹

跑:

npm install

等到它完成。现在您可以使用以下命令运行项目:

ionic serve -l

3
投票

我在更新到Ionic 4后遇到了这个问题。我最终不得不降级。

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


2
投票

退出命令面板并再次重新打开。它的作品。


0
投票

除了删除node_modules并运行@tnfaid所提到的npm install之外,我还删除了package-lock.json文件以确定。还运行npm audit fix,以解决任何漏洞。这对我有用。


0
投票

跑:

npm update  

这将使一切都很好。


0
投票

当我从Ionic 3升级到4时,发生了这种情况。问题是package.jsonionic.config.json都从3变为4.所以当你进行复制粘贴操作时,你必须要小心。

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

你可能有这样的事情

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

现在应该改为Ionic 4中的标准角度:

  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
© www.soinside.com 2019 - 2024. All rights reserved.