npm安装JSON,parse解析"...:"附近时,JSON中位置98处出现意外标记"}"(0x7D)\"vite build\"、\n}、\n\"设备依赖项..."

wz3gfoph  于 2022-11-24  发布在  其他
关注(0)|答案(1)|浏览(70)

你好,我正在安装npm install在我的laravel项目,但给我错误

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>

我已经尝试删除我的node_module中的package-lock.json,并且已经执行了这些操作

npm cache clear --force
npm cache verify

这两种方法都会产生同样的错误
我使用的 composer 版本

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

我的npm版本

npm version 9.1.1

我的软件包. 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"
    }
}
qlzsbp2j

qlzsbp2j1#

只需去掉vite build后面的逗号(,),问题就解决了。

{
    "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"
    }
}

相关问题