I have just created a capacitor project and I want to start it but I am getting the following error message:
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
Here is my package.json
file:
{
"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"
}
Notice that it is a fresh project. I have not changed anything yet.
Looks like you created the app with an old version of @capacitor/create-app
Use this command to make sure you are getting latest version npm init @capacitor/app@latest
.
The @latest
at the end makes it use latest version available.
Apps created with latest version have the start
npm script, but previous versions didn’t have it.