MiiZZo
@MiiZZo
JavaScript, React, NodeJS, Student

Как решить проблему билда webpack «This is probably not a problem with npm. There is likely additional logging output above.»?

// webpack.config.js
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const webpack = require("webpack")

const isDev = process.env.WEBPACK_MODE === "development";
const isProd = !isDev;

module.exports = {
  entry: "./src/index.tsx",
  output: {
    filename: "script.js",
    path: path.join(__dirname, "dist"),
    publicPath: "/",
  },
  plugins: [
    new TsconfigPathsPlugin({ configFile: "./tsconfig.json" }),
    new MiniCssExtractPlugin(),
    new HtmlWebpackPlugin({
        template: './src/index.html',
        minify: isProd
    }),
    new webpack.ProvidePlugin({
        process: 'process/browser',
      }),
    new CleanWebpackPlugin()
  ],
  resolve: {
    extensions: [".js", ".ts", ".tsx"],
    fallback: { 
        crypto: require.resolve("crypto-browserify"),
        "stream": require.resolve("stream-browserify")
    },
    alias: {
        process: "process/browser"
    }
  },
  devServer: {
    port: 3000,
    hot: isDev,
    historyApiFallback: true,
  },
  // optimization: optimization(),
  module: {
    rules: [
      {
        test: /\.(js|tsx?)$/,
        exclude: [/node_modules/],
        use: {
          loader: "ts-loader",
        },
      },
      {
        test: /\.css/,
        exclude: [/node_modules/],
        use: [MiniCssExtractPlugin.loader, "css-loader"],
      },
    ],
  },
};

Build error log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm@6.14.10
3 info using node@v14.15.4
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle editor@0.1.1~prebuild: editor@0.1.1
6 info lifecycle editor@0.1.1~build: editor@0.1.1
7 verbose lifecycle editor@0.1.1~build: unsafe-perm in lifecycle true
8 verbose lifecycle editor@0.1.1~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\mirot\Documents\projects\merge\1\2\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\dotnet\;C:\Users\mirot\AppData\Local\Microsoft\WindowsApps;;C:\Users\mirot\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\mirot\AppData\Roaming\npm;C:\Users\mirot\.dotnet\tools
9 verbose lifecycle editor@0.1.1~build: CWD: C:\Users\mirot\Documents\projects\merge\1\2
10 silly lifecycle editor@0.1.1~build: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'cross-env WEBPACK_MODE=production webpack --mode production'
10 silly lifecycle ]
11 silly lifecycle editor@0.1.1~build: Returned: code: 1 signal: null
12 info lifecycle editor@0.1.1~build: Failed to exec build script
13 verbose stack Error: editor@0.1.1 build: `cross-env WEBPACK_MODE=production webpack --mode production`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid editor@0.1.1
15 verbose cwd C:\Users\mirot\Documents\projects\merge\1\2
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.15.4
19 verbose npm v6.14.10
20 error code ELIFECYCLE
21 error errno 1
22 error editor@0.1.1 build: `cross-env WEBPACK_MODE=production webpack --mode production`
22 error Exit status 1
23 error Failed at the editor@0.1.1 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
  • Вопрос задан
  • 237 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы