我想建立我的项目
我写了这段代码来构建我的项目 npm run build 但我收到了这个错误:
ERROR in ./src/public/webfonts/fa-solid-900.svg
Module build failed: TypeError: Cannot read property 'context' of undefined
at Object.loader (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/file-loader/dist/index.js:34:49)
@ ./node_modules/css-loader??ref--5-1!./src/public/css/fontawesome-all.css 7:72144-72185
@ ./src/public/css/fontawesome-all.css
@ ./src/index.js
ERROR in ./src/public/webfonts/fa-brands-400.svg
Module build failed: TypeError: Cannot read property 'context' of undefined
at Object.loader (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/file-loader/dist/index.js:34:49)
@ ./node_modules/css-loader??ref--5-1!./src/public/css/fontawesome-all.css 7:70780-70822
@ ./src/public/css/fontawesome-all.css
@ ./src/index.js
Run Code Online (Sandbox Code Playgroud)
这是我的webpack.config.js:
const HtmlWebPackPlugin = require("html-webpack-plugin");
const htmlWebpackPlugin = new HtmlWebPackPlugin({
template: "./public/index.html",
filename: "./index.html"
});
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: …Run Code Online (Sandbox Code Playgroud) 我想构建我的应用程序,但我收到此错误消息:
ERROR in ./src/index.js
Module build failed: Error: Couldn't find preset "@babel/env" relative to directory "/Users/mohammadmehdi/Documents/Work/sevenapp"
at /Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map (<anonymous>)
at OptionManager.resolvePresets (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-loader/lib/index.js:50:20)
at Object.module.exports (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/babel-loader/lib/index.js:173:20)
Run Code Online (Sandbox Code Playgroud)
我的package.json:
{
"name": "sevenapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"babel-preset-react": "^6.24.1",
"bootstrap": "^4.0.0",
"html-webpack-plugin": "^3.2.0",
"jquery": "^3.3.1",
"rc-pagination": "^1.16.4",
"react": "^16.2.0",
"react-countup": "^3.0.3",
"react-dom": "^16.2.0",
"react-paginate": "^5.2.3",
"react-player": …Run Code Online (Sandbox Code Playgroud) 我正在使用 npm 版本 6.0.1。我的操作系统是 macOS High Sierra 版本 10.13.3
我想构建我的项目,但收到此错误消息:
Creating an optimized production build...
/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/webpack/lib/Chunk.js:533
throw new Error("Chunk.entrypoints: Use Chunks.addGroup instead");
^
Error: Chunk.entrypoints: Use Chunks.addGroup instead
at Chunk.set (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/webpack/lib/Chunk.js:533:9)
at /Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/extract-text-webpack-plugin/dist/index.js:176:40
at Array.forEach (<anonymous>)
at Compilation.<anonymous> (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/extract-text-webpack-plugin/dist/index.js:171:18)
at Compilation.applyPluginsAsyncSeries (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/react-scripts/node_modules/tapable/lib/Tapable.js:206:13)
at Compilation.seal (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:605:8)
at applyPluginsParallel.err (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:508:17)
at /Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/react-scripts/node_modules/tapable/lib/Tapable.js:289:11
at _addModuleChain (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:507:11)
at processModuleDependencies.err (/Users/mohammadmehdi/Documents/Work/sevenapp/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:477:14)
at process._tickCallback (internal/process/next_tick.js:172:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sevenapp@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! …Run Code Online (Sandbox Code Playgroud)