Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 网页包选项验证错误_Reactjs_Webpack - Fatal编程技术网

Reactjs 网页包选项验证错误

Reactjs 网页包选项验证错误,reactjs,webpack,Reactjs,Webpack,我试图在我的Windows10机器中运行我的网页 我在根文件夹中设置了网页包 这是我的webpack.config.js: const path = require("path"); const SRC_DIR = path.join(__dirname, "/client/src"); const DIST_DIR = path.join(__dirname, "client/dist"); module.exports = { config: `${SRC_DIR}/index.js

我试图在我的Windows10机器中运行我的网页

我在根文件夹中设置了网页包

这是我的webpack.config.js:

const path = require("path");

const SRC_DIR = path.join(__dirname, "/client/src");
const DIST_DIR = path.join(__dirname, "client/dist");

module.exports = {
  config: `${SRC_DIR}/index.jsx`,
  output: {
    filename: `bundle.js`,
    path: DIST_DIR
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        include: SRC_DIR,
        loader: "babel-loader",
        query: {
          presets: ["react", "es2015"]
        }
      }
    ]
  },
  mode: "development"
};
然后在my package.json文件中:

{
  "name": "rform",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
    "build": "webpack --config webpack.config.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-preset-es2015": "^6.24.1",
    "webpack": "^4.12.0",
    "webpack-command": "^0.2.1"
  }
}
运行
npm run build
时,我得到了ff错误:

ValidationError: config-loader

  Options Validation Error

  options['config']  is an invalid additional property

    at validate (/mnt/c/xampp/htdocs/rform/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
    at validator (/mnt/c/xampp/htdocs/rform/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
    at resolve.then (/mnt/c/xampp/htdocs/rform/node_modules/@webpack-contrib/config-loader/lib/index.js:18:7)
    at process._tickCallback (internal/process/next_tick.js:109:7)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

npm ERR! Linux 4.4.0-17134-Microsoft
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v7.10.1
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rform@1.0.0 build: `webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rform@1.0.0 build script 'webpack --config webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the rform package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --config webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs rform
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls rform
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/darrenchui/.npm/_logs/2018-06-13T07_55_50_484Z-debug.log

我确保在dist和src文件夹中运行正确的文件设置。我在配置上做错了什么?请帮忙

在他们的
网页配置
选项中没有任何称为
配置

请从下面的链接查看他们的配置选项

我想,如果您在下面的选项中将
config
替换为
entry
,它就会起作用

module.exports = {
  entry: `${SRC_DIR}/index.jsx`,
  output: {
    filename: `bundle.js`,
    path: `DIST_DIR`
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        include: SRC_DIR,
        exclude: /node_modules/,
        loader: "babel-loader",
        query: {
          presets: ["react", "es2015"]
        }
      }
    ]
  },
  mode: "development"
};

我是根据你的建议得到这个错误的:@JonDobie error说它在node_模块中发现了未知选项。我已经更新了答案,并在模块选项中添加了排除选项。你能再试一次吗?