无法浏览部署到Heroku

时间:2018-02-28 06:02:15

标签: javascript node.js reactjs heroku eslint

  

当浏览器中的wirite https://tictactoesko.herokuapp.com/时,我   回复下面的错误消息:

     

无法编译./src/index.js模块构建失败:错误:无法   找到模块' eslint / lib / formatters / fashion'

     

我的index.js看起来像这样   导入反应来自'反应'   从' react-dom'导入ReactDOM   import' ./ index.css'   从' ./ Game'

导入游戏

ReactDOM.render(,document.getElementById(' root'))

  

我的package.json看起来像这样

{
  "name": "tic-tac-toe",
  "version": "0.1.0",
  "private": true,
  "eslintConfig": {
    "env": {
      "es6": true
    },
    "parserOptions": {
      "ecmaVersion": 8,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true
      }
    },
    "extends": [
      "standard",
      "react-app",
      "plugin:jsx-a11y/recommended" 
    ],
    "plugins": [
      "jsx-a11y",
      "react"
      ],
    "rules": {
      "no-trailing-spaces": "off",
      "padded-blocks":"off",
      "jsx-a11y/href-no-hash":"off"
   }
  },
  "jest": {
    "testMatch": [
      "**/test/**/*.js?(x)"
    ],
    "collectCoverage": true,
    "coverageDirectory": "coverage",
    "coverageThreshold": {
      "global": {
        "branches": 100,
        "functions": 100,
        "lines": 100,
        "statements": 100
      }
    }
  },
  "dependencies": {
    "chromedriver": "^2.35.0",
    "jest-cli": "^22.3.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.1.1",
    "selenium-webdriver": "^4.0.0-alpha.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "lint": "./node_modules/.bin/eslint  src/** test/** ",
    "test": "jest",
    "eject": "react-scripts eject",
    "cypress:open": "cypress open"
  },
  "devDependencies": {
    "babel-eslint": "^7.2.3",
    "babel-jest": "^22.2.2",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "cypress": "^2.0.3",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "eslint": "^4.18.1",
    "eslint-config-google": "^0.9.1",
    "eslint-config-react-app": "^2.1.0",
    "eslint-config-standard": "^11.0.0",
    "eslint-plugin-flowtype": "^2.46.1",
    "eslint-plugin-import": "^2.9.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-node": "^6.0.1",
    "eslint-plugin-promise": "^3.6.0",
    "eslint-plugin-react": "^7.7.0",
    "eslint-plugin-standard": "^3.0.1",
    "jest": "^22.3.0",
    "react-test-renderer": "^16.2.0"
  }
}
  

这是travis.yml   语言:node_js node_js:    - 节点插件:sonarcloud:before_script:    - npm start - --silent&脚本:    - npm run lint    - npm测试    - 声纳扫描仪-Dsonar.projectKey =井字游戏-Dsonar.organization = steinko-github上-Dsonar.sources = SRC,测试-Dsonar.host.url = https://sonarcloud.io -Dsonar.login = 6472ac35c070752487408fd8c946cca6b536eec2 -Dsonar.javascript.lcov .reportPaths =覆盖/ lcov.info    - $(npm bin)/ cypress run --record --key a1319fd9-2c6e-4888-8f02-e62f02b5001b deploy:provider:heroku
  API_KEY:       确保:iHZKdF2ZoiXshgTeDfAR8YjhChchFLMSAxU9i62eB / XGzj6VQ2iV9RS9OnD + dfOJAebk40rtEbyxv9Vx4RXBsWCNVMifg6rMoAiW9Bp3Us8Idw5f2kLKD0Sx6qzNZqdn9TzQT3EU12jLjIgpUse9PfJxisd / HZqmtdYQdJCMGcgOZk4lZJmbpe8tmCcU0tnUPxJnuDPUzkrViAK3pe / T8 / m1mdZAZ4 + 2mAIXuJzsf // JJimdwIE3ZqSoxQjEo9l4QmXcdStrC3iAx + GLgjt2j9Rf0ERnuKYPdfSxPUw8O4 / tJHEyF32E + mUPNxX1PvEyzkP6NtBss / 288W0NPg42rxilEivNeJxWS8fGgUyQx52dHXcBZEdPOsye233WtEHvlIYzDj2Gp + IqD6Q2PhptobqK7XJuyM7xS3QH8Yao / JB2ZYz9PnZzngsfC3cohgxFJ3YjWVmfy87Y / BB5JBVAXARMwg6zvKKt + lHdsVbR3CcHN01S9wG4YgdiAViaIa5vEOUcI7OCGRdYlyJTKau4ENj / DahPxG + L7 + wbrx292kL / 9zgg0fINaByBOg + YSJN / OMQOphNMQZR / gUpf / N1T6uZVogH + ZgzY7XXtSRI3EFl4GgIcHFxoNulvNRmJOR04sK0cyznuwifmLjGiuxGCUeI9MUbSoAiNws7KrK6i9uw =   app:tictactoesko

     

部署日志feom Heroku看起来像这样   构建依赖项          安装节点模块(package.json + package-lock)          最新的11.521s   ----->缓存构建          清除以前的节点缓存          保存2个cacheDirectories(默认):           - node_modules           - bower_components(无需缓存)   ----->建立成功!   ----->发现流程类型          Procfile声明类型 - > (没有)          buildpack的默认类型 - >卷筒纸   ----->压缩...          完成:57.4M   ----->发射...          发布v11          https://tictactoesko.herokuapp.com/部署到Heroku

     

当浏览器中的wirite https://tictactoesko.herokuapp.com/时,我   回复下面的错误消息:

     

无法编译./src/index.js模块构建失败:错误:无法   找模块' eslint / lib / formatters / fashion'   我怎么能纠正这个错误?

1 个答案:

答案 0 :(得分:1)

您手动安装了eslint,这可能会破坏事情。您应该将其卸载并仅编辑.eslintrc文件。在这个Github issue

中查看@gaearon的评论

但是如果你想直接控制并自定义一切。我会弹出项目:npm run eject。查看Create React App的指南。