closure-webpack-plugin: Error: Cannot call write after a stream was destroyed
I’m just installed the Clorsure Webpack plugin as mentined in the docs:
yarn add closure-webpack-plugin@next google-closure-compiler@webpack-beta -D
The webpack.config.js file is as follows:
const path = require('path')
const webpack = require('webpack')
const ClosurePlugin = require('closure-webpack-plugin')
module.exports = {
entry: {
'dashboard': './pages/dashboard/entry.js',
'auth': './pages/auth/entry.js',
},
optimization: {
minimizer: [
new ClosurePlugin({mode: 'STANDARD'}, {
// compiler flags here
//
// for debuging help, try these:
//
formatting: 'PRETTY_PRINT',
debug: true,
renaming: false,
})
]
},
output: {
path: path.resolve(__dirname, 'static/build'),
filename: '[name].js'
},
};
When using command webpack --mode production
I’m getting the following error:
PS > npm run build
> acme-desktop-app-infra@0.2.0 build C:\acme\webfront\src
> webpack --mode production
events.js:167
throw er; // Unhandled 'error' event
^
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:406:19)
at writeOrBuffer (_stream_writable.js:394:5)
at Socket.Writable.write (_stream_writable.js:294:11)
at Socket.Writable.end (_stream_writable.js:579:10)
at Socket.end (net.js:544:31)
at process.nextTick (C:\acme\webfront\src\node_modules\closure-webpack-plugin\src\closure-compiler-plugin.js:820:31)
at process._tickCallback (internal/process/next_tick.js:61:11)
Emitted 'error' event at:
at onwriteError (_stream_writable.js:425:12)
at onwrite (_stream_writable.js:456:5)
at doWrite (_stream_writable.js:406:11)
at writeOrBuffer (_stream_writable.js:394:5)
[... lines matching original stack trace ...]
at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! acme-desktop-app-infra@0.2.0 build: `webpack --mode production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the acme-desktop-app-infra@0.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\acme\AppData\Roaming\npm-cache\_logs\2018-12-17T06_50_34_865Z-debug.log
What I’m doing wrong?
Node v10.13.0 Webpack v4.25.1 closure-webpack-plugin: 2.0.0-rc.10 google-closure-compiler-java: 20181209.0.0-webpack-beta google-closure-compiler-js: 20181209.0.0-webpack-beta google-closure-compiler-linux: 20181209.0.0-webpack-beta google-closure-compiler-osx: 20181209.0.0-webpack-beta google-closure-compiler: 20181209.0.0-webpack-beta
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 18 (5 by maintainers)
I had the same problem on Windows 7. I solved it by opening the CMD console as an administrator.
I’ve thrown the idea to use this library from the beginning and was right.
For me that did the trick as well.
What’s “interesting” is that after a successful build as Administrator, building as a plain user works again.