【问题标题】:React Setup 'npm run build' error "unexpected token 'b' at 18:4"React Setup 'npm run build' 错误“在 18:4 出现意外的令牌 'b'”
【发布时间】:2017-10-23 22:44:20
【问题描述】:

目前正在使用本教程:http://www.zsoltnagy.eu/step-by-step-environment-setup-of-the-react-developer-no-legacy-2016-standards/

我以为我正确地遵循了一切,但是当我尝试第七步时,我得到了这个错误(见图)。

这是我的 package.json 文件 - 我承认我可能在尝试让它自己工作时更改了一些东西。

{
"name": "rapp",
"version": "1.0.0",
"description": "\"\"",
"main": "index.js",
"repository": {
    "type": "git",
    "url": "\"\""
},
"keywords": [
    "\"\""
],
"author": "\"BH0\"",
"license": "ISC",
"scripts": {

    "test": "\"\""
    "build": "webpack -d && cp src/app/index.html dist/index.html && webpack-dev-server --hot --inline --colors --progress --content-base src/",
    "build-prod": "webpack -p && cp src/app/index.html dist/index.html"
}

}

谢谢。 Screen-shot of error displayed in Console after entering 'npm run build'

【问题讨论】:

    标签: javascript json node.js reactjs


    【解决方案1】:

    您可能应该在“test”之后添加一个逗号:“\”\“”

    【讨论】:

      【解决方案2】:

      您的 package.json 无效。删除脚本部分中的测试条目或在其后面添加,。现在它应该可以工作了。

      应该是

      {
      "name": "rapp",
      "version": "1.0.0",
      "description": "\"\"",
      "main": "index.js",
      "repository": {
          "type": "git",
          "url": "\"\""
      },
      "keywords": [
          "\"\""
      ],
      "author": "\"BH0\"",
      "license": "ISC",
      "scripts": {
      
          "test": "\"\"",
          "build": "webpack -d && cp src/app/index.html dist/index.html && webpack-dev-server --hot --inline --colors --progress --content-base src/",
          "build-prod": "webpack -p && cp src/app/index.html dist/index.html"
      }
      

      【讨论】:

        猜你喜欢
        • 2021-03-03
        • 2019-05-29
        • 2021-12-07
        • 2021-07-03
        • 2021-10-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多