电容器缺少脚本:“开始”

问题描述 投票:0回答:1

我刚刚创建了一个电容器项目,我想启动它,但收到以下错误消息:

PS C:\Users\Lenovo\Documents\my-app> npm run start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Lenovo\AppData\Local\npm-cache\_logs\2024-04-27T08_41_01_552Z-debug.log

这是我的

package.json
文件:

{
  "name": "capacitor-app",
  "version": "1.0.0",
  "description": "An Amazing Capacitor App",
  "main": "index.js",
  "keywords": [
    "capacitor",
    "mobile"
  ],
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@capacitor/core": "latest",
    "@capacitor/camera": "latest",
    "@capacitor/splash-screen": "latest"
  },
  "devDependencies": {
    "@capacitor/cli": "latest"
  },
  "author": "",
  "license": "ISC"
}

请注意,这是一个新项目。我还没有改变任何东西。

ionic-framework capacitor
1个回答
0
投票

看起来您使用旧版本的

@capacitor/create-app

创建了该应用程序

使用此命令确保您获得最新版本

npm init @capacitor/app@latest
。 最后的
@latest
使其使用可用的最新版本。

使用最新版本创建的应用程序具有

start
npm 脚本,但以前的版本没有。

© www.soinside.com 2019 - 2024. All rights reserved.