Home > Enterprise >  npm install JSON.parse Unexpected token "}" (0x7D) in JSON at position 98 while parsing ne
npm install JSON.parse Unexpected token "}" (0x7D) in JSON at position 98 while parsing ne

Time:11-17

hello i am installing npm install in my laravel project but gives me error

npm ERR! code EJSONPARSE
npm ERR! path C:\xampp\htdocs\laravel_project/package.json
npm ERR! JSON.parse Unexpected token "}" (0x7D) in JSON at position 98 while parsing near "...: \"vite 
build\",\n    },\n    \"devDependenc..."
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\my_PC\AppData\Local\npm-cache\_logs\2022-11-16T13_59_50_980Z-debug-0.log
PS C:\xampp\htdocs\laravel_project> 

i already tried to delete my package-lock.json in my node_module and already did these

npm cache clear --force
npm cache verify

both of them gives me the same error

my using composer version

Composer version 2.4.4 2022-10-27 14:39:29

my npm version

npm version 9.1.1

my package.json

{
    "private": true,
    "scripts": {
        "dev": "vite",
        "build": "vite build",
    },
    "devDependencies": {
        "@popperjs/core": "^2.10.2",
        "@vitejs/plugin-vue": "^3.0.1",
        "axios": "^1.1.2",
        "bootstrap": "^5.2.1",
        "laravel-vite-plugin": "^0.6.0",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "sass": "^1.32.11",
        "vite": "^3.0.0",
        "vue": "^3.2.37"
    }
}

CodePudding user response:

Just remove the comma (,) after vite build and problem will be solved.

{
    "private": true,
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "@popperjs/core": "^2.10.2",
        "@vitejs/plugin-vue": "^3.0.1",
        "axios": "^1.1.2",
        "bootstrap": "^5.2.1",
        "laravel-vite-plugin": "^0.6.0",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "sass": "^1.32.11",
        "vite": "^3.0.0",
        "vue": "^3.2.37"
    }
}
  • Related