Ask coding questions

← Back to all posts
[SOLVED] Electron npm ERR! missing script: start
Squirrel777 (141)

So I made a post about this like a week ago, and I did not get some helpful answers. I am trying to make an electron app using its tutorial and whenever I try to run the code using npm start, I get the following error:

npm ERR! missing script: start

And dont think that its just that I forgot to put "start": "electron ." because I already did that
Here is my file structure:

APP/
 >node-modules
 index.html
 main.js
 package-lock.json
 package.json

Here is my package.json:

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1", 
    "start": "electron ."
  },
  "author": "me",
  "license": "ISC"
}

And my main.js:

const { app, BrowserWindow } = require('electron')

// Create the window, don't rename the function!
function createWindow () {
  // Create the browser window.
  const win = new BrowserWindow({
    // Width and height of the window, feel free
    // to edit it.
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })

  // Load the index.html file of the app (we will create
  // it later)
  win.loadFile('index.html')
}

// Run the app when it's ready
app.whenReady().then(createWindow)

What am I doing wrong?

Comments
hotnewtop
Squirrel777 (141)

nevermind I was using the wrong terminal lol @Coder100

Coder100 (18893)

yeah making sure you are in the right folder helps xd @Squirrel777