Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: EACCES: permission denied using webpack

I'm attempting to use webpack for the first time and I'm getting this error,

Error: EACCES: permission denied, mkdir '/dist'
    at Error (native)

when trying to run my production script.

A sudo chown -R 'whoami' /dist came back with chown: /dist: No such file or directory.

How can I go about resolving this?

like image 858
CalAlt Avatar asked May 26 '17 16:05

CalAlt


1 Answers

As Camp bell mentioned you need to remove forward slash before dist folder in the output path section.

In my case I had to remove forward slash before build. Check my example below

Wrong one:

output: {
    path: path.resolve(__dirname, "/build/"), //remove forward slash here
    publicPath: "/",
    filename: "bundle.js"
}

Correct one:

output: {
    path: path.resolve(__dirname, "build/"),
    publicPath: "/",
    filename: "bundle.js"
}

Hope this helps.

like image 124
Hemadri Dasari Avatar answered Nov 06 '22 00:11

Hemadri Dasari