Ionic:package.json缺少启动脚本

czfnxgou  于 2023-03-11  发布在  Ionic
关注(0)|答案(2)|浏览(183)

我的package.json没有启动脚本,所以npm启动不起作用。
我的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"
}

启动脚本应包含什么内容?

mum43rcc

mum43rcc1#

据我所知,Ionic项目不使用package.json中的启动脚本,因此不需要npm start
使用ionic start创建新项目,并使用ionic serve在开发期间运行项目,如Getting Started Guide中所述。
在需要的时候还有其他命令来构建、部署和打包您的项目,请确保检查离子文档以了解如何以“离子方式”执行这些操作

3mpgtkmj

3mpgtkmj2#

运行命令

离子积分启用cordova --add

更新config.xml文件和package.json文件
用于构建目的

相关问题