简体   繁体   English

使用“ Webpack”构建应用时遇到错误:4,LoadConfigError:找不到模块“ sigmund”

[英]Facing error while building app with “Webpack”: 4, LoadConfigError: Cannot find module 'sigmund'

I'm using Webpack 4 and getting error when I'm building my app. 我在使用Webpack 4并在构建应用程序时出错。 I have also attached both snapshot of the error that I'm facing and Webpack configuration code. 我还附加了我所遇到的错误的快照和Webpack配置代码。

Please help me to resolve this issue. 请帮助我解决此问题。 I'm using: OS: Ubuntu 18.04, Webpack: 4 NodeJs: NodeJS LTS 10, NPM: 5.6.0 我正在使用:操作系统:Ubuntu 18.04,Webpack:4 NodeJs:NodeJS LTS 10,NPM:5.6.0

Snapshot of error here 错误快照在这里

My Webpack.config.prod.js Config: 我的Webpack.config.prod.js配置:

 var webpack = require('webpack'); var path = require('path'); var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // var OfflinePlugin = require('offline-plugin') // const CompressionPlugin = require("compression-webpack-plugin") const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); module.exports = { entry: { '/js/app': './frontend/app.js' }, output: { filename: 'app.js', chunkFilename: '[name].js', publicPath: "/public/js/", path: path.resolve(__dirname, 'public', 'js') }, module: { rules: [ { test: /jquery.+\\.js$/, use: [{ loader: 'expose-loader', options: 'jQuery' },{ loader: 'expose-loader', options: '$' }] }, { test: /\\.(scss|css|sass)$/i, use: [ // { // loader: MiniCssExtractPlugin.loader, // options: { // // you can specify a publicPath here // // by default it use publicPath in webpackOptions.output // publicPath: '../' // } // }, { loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader", options: { includePaths: [ path.resolve("./node_modules/") ] } } ] }, { test: /\\.js$/, loader: "babel-loader", include: [ path.resolve(__dirname, "frontend"), ], exclude: [ path.resolve(__dirname, "node_modules") ], }, { test: /\\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/, loader: 'url-loader?limit=4096&name=[name]-[hash].[ext]' }, { test: /\\.json$/, loader: 'json-loader', type: "javascript/auto" } ]}, node: { fs: "empty", net: "empty" }, optimization: { minimizer: [new UglifyJsPlugin()] }, performance: { maxEntrypointSize: 512000, maxAssetSize: 512000 }, plugins: [ new BundleAnalyzerPlugin({ analyzerHost: "0.0.0.0" }), new UglifyJsPlugin({ test: /\\.js(\\?.*)?$/i, parallel: true, extractComments: 'all' }), new MiniCssExtractPlugin({ filename: "[name].css", chunkFilename: "[id].css" }), new webpack.ProvidePlugin({ jQuery: 'jquery', $: 'jquery', jquery: 'jquery', 'window.jQuery': 'jquery', Popper: ['popper.js', 'default'], }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }), new OptimizeCSSAssetsPlugin({ assetNameRegExp: /\\.optimize\\.css$/g, cssProcessor: require('cssnano'), cssProcessorPluginOptions: { preset: ['default', { discardComments: { removeAll: true } }], }, canPrint: true }) ] } 

尝试运行npm i sigmund然后再次运行构建脚本。

Reinstall your npm , your node+npm installation might be broken: 重新安装您的npm ,您的node + npm安装可能会被破坏:

curl https://www.npmjs.org/install.sh | sh curl https://www.npmjs.org/install.sh | sh might help curl https://www.npmjs.org/install.sh | sh可能会有所帮助

Addressed on Github: https://github.com/npm/npm/issues/6795 在Github上地址: https : //github.com/npm/npm/issues/6795

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM