离子:package.json 缺少启动脚本
Posted
技术标签:
【中文标题】离子:package.json 缺少启动脚本【英文标题】:Ionic: package.json missing start script 【发布时间】:2018-11-30 09:03:13 【问题描述】:我的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"
启动脚本应该包含什么?
【问题讨论】:
请帮我解决这个错误 您确实缺少脚本。事实上,您似乎漏掉了一个完整的问题。我所看到的只是一些乱七八糟的 JSON,它对您的问题一无所知。请准确描述您所坚持的内容、预期行为、表现出的错误行为,以及您为从前者到后者所做的努力。 这里有什么问题 【参考方案1】:据我发现,Ionic 项目在 package.json 中不使用启动脚本,因此不需要 npm start
。
使用ionic start
创建一个新项目并使用ionic serve
在开发过程中运行该项目,如Getting Started Guide 中所述。
还有其他命令可以在需要时构建、部署和打包您的项目,请务必查看 ionic 文档以了解如何以“Ionic 方式”执行这些操作
【讨论】:
以上是关于离子:package.json 缺少启动脚本的主要内容,如果未能解决你的问题,请参考以下文章
`package.json` 顺序启动脚本只执行其中一个脚本
我应该在 NPM package.json 中将我的“启动”脚本设置为啥?
package.json 启动脚本,babel-node:在 heroku deploy 上找不到