反应-运行开发服务器

时间:2019-11-17 23:02:51

标签: reactjs npm cmd

  • 在反应中克隆git代码。
  • 安装npm。

问题-

由于某种原因,我无法运行dev-server。 我在cmd上打了两个命令 1. npm运行dev-server

我得到1个错误的“样本”-

  

警告:eslint-plugin-react设置中未指定React版本。看到   https://github.com/yannickcr/eslint-plugin-react#configuration。   C:\ Users \ Alon \ Desktop \ skillz_fontend \ src \ components \ Inputs \ GooglePlacesInput.jsx   57:30错误,缺少分号半

  1. npm开始-
  

C:\ Users \ Alon \ Desktop \ skillz_fontend> npm启动npm错误!缺少脚本:启动npm ERR! npm ERR!你是这个意思吗npm ERR!统计资料   npm ERR!有关此运行的完整日志,请参见:npm ERR!
  C:\ Users \ Alon \ AppData \ Roaming \ npm-cache_logs \ 2019-11-17T22_59_13_787Z-debug.log

感谢阿隆

2 个答案:

答案 0 :(得分:8)

当您看到这样的警告时:

Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .

尝试在您的eslint配置文件中添加React版本设置,例如.eslintrc.js,如下所示:

答案 1 :(得分:0)

module.exports = {
  env: {
    browser: true,
    es2021: true,
    jest: true,
    'react-native/react-native': true,
  },
  extends: [
    'eslint:recommended',
    'plugin:react/recommended',
    'plugin:react-hooks/recommended',
    'plugin:react-native/all',
  ],
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 12,
    sourceType: 'module',
  },
  plugins: ['react', 'react-hooks', 'react-native'],
  rules: {
    'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
    'global-require': 0,
    'operator-linebreak': [2, 'before'],
  },

  settings: {
    react: {
      version: "detect"
    }
  }
};