离子:package.json缺少启动脚本

时间:2018-06-21 06:17:39

标签: ionic-framework npm

我的package.json没有启动脚本,因此npm start不起作用。

我的package.json看起来像

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "@agm/core": "1.0.0-beta.0",
    "es6-promise": "3.0.2",
    "es6-shim": "^0.35.0",
    "ionic-angular": "2.0.0",
    "ionic-native": "^2.2.14",
    "ionicons": "3.0.0",
    "ng2-cordova-oauth": "0.0.6",
    "rxjs": "5.0.0-beta.12",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.1.5"
  },
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard",
    "cordova-plugin-inappbrowser"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "third-party-auth-ionic2-tutorial: An Ionic project"
}

启动脚本应包含什么?

1 个答案:

答案 0 :(得分:0)

根据我的发现,离子项目不在package.json中使用启动脚本,因此不需要npm start

按照Getting Started Guide所述,在开发过程中使用ionic start创建一个新项目,并使用ionic serve运行该项目。

还有其他一些命令可以在需要时生成,部署和打包项目,请确保检查离子文档以了解如何以“离子方式”完成这些操作