copy-webpack-plugin: permission denied, mkdir

After upgrading from version 1.1.1 to 2.0.0 I get the following error… no other configuration has changed.

Unhandled rejection Error: EACCES: permission denied, mkdir '/_karma_webpack_'
    at Error (native)

Is this a known issue? Do you have any idea what might be going on? I looked around but couldn’t find anything. Downgrading back to 1.1.1 works as before, which is pretty weird given the error is related to permission denied.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 21 (5 by maintainers)

Most upvoted comments

fix it. DO NOT add slash at front.
{ from: path.join(__dirname, ‘…/src/_locales’), to: ‘/_locales’ } ====> wrong, error permission denied
{ from: path.join(__dirname, ‘…/src/_locales’), to: ‘_locales’ } ====> right

Per the webpack docs , changing output.path to __dirname + “/your-export-directory” should resolve this

3.0.0 seems to work for us, although we already used another workaround which we will probably keep (disable plugins for our tests).

yes I also faced this issue in latest version webpack, then I found that by removing the “/” from the beginning of the path`s, resolved the issue. firstly I have done this: let path = require(‘path’), HtmlWebpackPlugin = require(‘html-webpack-plugin’); module.exports = { entry: ‘./index.js’, output: { filename: ‘[name]-bundle-[hash].js’, path: path.resolve(__dirname,‘/public’) }, module: { rules:[{ test: /.js$/, exclude: /node_modules/, use: ‘jshint-loader’ }] }, plugins: [ new HtmlWebpackPlugin({ template: “/public/index.html” }) ] }

Then by removing “/” let path = require(‘path’), HtmlWebpackPlugin = require(‘html-webpack-plugin’); module.exports = { entry: ‘./index.js’, output: { filename: ‘[name]-bundle-[hash].js’, path: path.resolve(__dirname,‘public’) }, module: { rules:[{ test: /.js$/, exclude: /node_modules/, use: ‘jshint-loader’ }] }, plugins: [ new HtmlWebpackPlugin({ template: “public/index.html” }) ] }

I’m having this issue on v3.0.1, so I would guess that @jseminck’s problem was solved by disabling the plugin rather than the version bump

Hmm. Ok. Our configuration is nothing special, just a bunch of from/to objects:

new CopyWebpackPlugin([
    {
        from: path.join(__dirname, "resources", "some_dir"),
        to: "some_dir"
    },
    ... about 10 of these
]

Looks like it only happens when executing tests. so there is some combination of plugins messing up somewhere. I’ll dig around a bit and let you know if I figure out some more information (as I don’t have anything else right now).