npm ERR! code EJSONPARSE

Asked

Viewed 910 times

-1

Somebody please help me solve this problem?

C:\Users\teamc\Desktop\Electron>npm i asar --save-dev
npm ERR! file C:\Users\teamc\Desktop\Electron\package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token { in JSON at position 1 while parsing near '{{
npm ERR! JSON.parse "name": "hsecteam"...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

My package.json :

{{
    "name": "hsecteam",
    "version": "0.0.1",
    "description": "Sem descrição",
    "main": "index.js",
    "scripts": {
        "start": "electron index.html"
        "package": "",
        "build": "electron-packager . YoutubeTutorial"
    },
    "author": "Gustavo Oliveira",
    "license": "MIT",
    "dependencies": {
        "electron": "^4.1.4"
    },
    "devDependencies": {
        "electron-packager": "^13.1.1"
    }
}

Note: I have tried the command

# npm cache clean

1 answer

0

You gave a npm cache clean and then gave a npm install again? I gave a brief analysis here on your package json., probably right there in scripts->start there’s a guy named package, I believe that he should not be there, the probably is there because after the end of the start does not have the , then he understands that everything would be on the same line, I sent the way yours is, and I’ll send the likely way that it should be.

ANCIENT

{
  "name": "hsecteam",
  "version": "0.0.1",
  "description": "Sem descrição",
  "main": "index.js",
  "scripts": {
    "start": "electron index.html" "package": "",
    "build": "electron-packager . YoutubeTutorial"
  },
  "author": "Gustavo Oliveira",
  "license": "MIT",
  "dependencies": {
    "electron": "^4.1.4"
  },
  "devDependencies": {
    "electron-packager": "^13.1.1"
  }
}

PROBABLY RIGHT WAY:

{
  "name": "hsecteam",
  "version": "0.0.1",
  "description": "Sem descrição",
  "main": "index.js",
  "scripts": {
    "start": "electron index.html",
    "package": "",
    "build": "electron-packager . YoutubeTutorial"
  },
  "author": "Gustavo Oliveira",
  "license": "MIT",
  "dependencies": {
    "electron": "^4.1.4"
  },
  "devDependencies": {
    "electron-packager": "^13.1.1"
  }
}

NOTE: If using the visual code, use ALT + SHIFT + F to automatically indent

  • I did it, it helped me a lot! However, when I gave the build -w the application is being compiled, however a javascript error is appearing.

  • Make the mistake, sometimes I can help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.