找不到Entry模块中的错误

时间:2017-11-15 23:30:38

标签: json webpack

这是错误:

  

SyntaxError:位于322的JSON中的意外标记}但是JSON文件   是对的。

JSON文件:

    {
      "name": "gl",
      "version": "1.0.0",
      "description": "GL online CV",
      "main": "index.html",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Alex Guzhyk",
      "license": "ISC",
      "dependencies": {
        "express": "^4.16.2",
        "react": "^16.1.1",
        "react-dom": "^16.1.1",
      },
      "devDependencies": {
        "babel-core": "^6.26.0",
        "babel-loader": "^7.1.2",
        "babel-preset-env": "^1.6.1",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-react": "^6.24.1",
        "webpack": "^3.8.1",
        }
    }

2 个答案:

答案 0 :(得分:2)

验证您的JSON以了解格式是否正确。

删除集合末尾的尾随逗号。

{
      "name": "gl",
      "version": "1.0.0",
      "description": "GL online CV",
      "main": "index.html",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Alex Guzhyk",
      "license": "ISC",
      "dependencies": {
        "express": "^4.16.2",
        "react": "^16.1.1",
        "react-dom": "^16.1.1"
      },
      "devDependencies": {
        "babel-core": "^6.26.0",
        "babel-loader": "^7.1.2",
        "babel-preset-env": "^1.6.1",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-react": "^6.24.1",
        "webpack": "^3.8.1"
        }
    }

你可以在这里查看: https://jsonlint.com/

答案 1 :(得分:0)

在JSON中,您不能使用尾随逗号。

使用不正确

"person": {
  "age": 31,
  "gender": "male",
}

与javascript不同,JSON是一种严格的数据格式,不是javascript!它只是从它派生而来。

因此,在JSON中,您不能添加a trailing comma

正确使用

"person": {
  "age": 31,
  "gender": "male"
}