Q: running npm run dev reports an error, but I can't find a solution after checking for a long time. Turn to the predecessors of the forum for help.

after using webpack, to configure for the first time, the result of running npm run dev was wrong. After searching a lot of information on the Internet, we can"t solve it. Ask the elders to give us some advice. Thank you very much!

error content

npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token / while parsing "{
npm ERR!   "name": "vue-loader-demo",
npm ERR!   "versio"
npm ERR! File: /Users/sylvia/Documents/FE/Practice/vue/vue-loader-demo/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sylvia/.npm/_logs/2018-04-17T12_39_56_372Z-debug.log

package.js

{
  "name": "vue-loader-demo",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "build": "webpack",
    "dev": "webpack-dev-server --devtool eval --progress --colors --hot" //
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "webpack": "^4.5.0",
    "webpack-dev-server": "^3.1.3"
  }
}

File structure


|-index.html

|-main.js    

|-App.vue   

|-package.json  

|-webpack.config.js  

"dev": "webpack-dev-server-- devtool eval-- progress-- colors-- hot" / / means automatic screen refresh
package.json cannot be annotated.


right solution upstairs.

clipboard.png

json


  1. package.json
  2. package.jsonjsonjs

clipboard.png

I see that your catalog has been changed, or do you report the same error?

Menu