PS E:\VUE\vue3\webpack1> npm run dev
npm ERR! code EJSONPARSE
npm ERR! path E:\VUE\vue3\webpack1/package.json
npm ERR! JSON.parse Unexpected token "/" (0x2F) in JSON at position 186 while parsing near "... \"dev\": \"webpack\"   //script节点下的脚本,可以通过n..."
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\HP\AppData\Local\npm-cache\_logs\2022-04-20T12_11_45_541Z-debug-0.log

原因:package.json文件格式问题

解决方法:

1.看每一个节点中的键值对是否都用" "引起来,并且最和一个键值对后面不用‘,’

2.看package.json文件中是否有注释,然后删除(这个是我用的方法,并且已解决)

成功运行结果:

PS E:\VUE\vue3\webpack1>
                         npm run dev

> webpack1@1.0.0 dev
> webpack

[webpack-cli] Compilation finished
asset main.js 324 KiB [emitted] (name: main)
runtime modules 931 bytes 4 modules
cacheable modules 282 KiB
  ./src/index.js 452 bytes [built] [code generated]
  ./node_modules/jquery/dist/jquery.js 282 KiB [built] [code generated]
webpack 5.5.1 compiled successfully in 271 ms

Logo

前往低代码交流专区

更多推荐