Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/DumpStack.log.tmp'

Tags:

webpack

I run npm run watch on WSL2 (Ubuntu 20.04.1 LTS). But get the following error.

Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/DumpStack.log.tmp'
Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/hiberfil.sys'
Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/pagefile.sys'
Watchpack Error (initial scan): Error: EACCES: permission denied, lstat '/mnt/c/swapfile.sys'

This is my webpack config

const path = require('path');
const devMode = process.env.NODE_ENV !== 'production';
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
    entry: {
        "main": './views/js/main.js'
    },
    mode: 'development',
    output: {
        filename: 'js/[name].js',
        chunkFilename: 'js/[id].[chunkhash].js',
        path: path.resolve(__dirname, 'public')
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                enforce: "pre",
                use: ["source-map-loader"],
            },
            {
                test: /\.css$/,
                exclude: /node_modules/,
                use: [
                    { loader: MiniCssExtractPlugin.loader },
                    {
                        loader: 'css-loader',
                        options: {
                            importLoaders: 1,
                        }
                    },
                    { loader: 'postcss-loader' }
                ]
            }
        ]
    },
    plugins: [
        new MiniCssExtractPlugin({
            filename: devMode ? 'css/[name].css' : 'css/[name].[hash].css'
        })
    ],
    devtool: 'cheap-module-source-map'
}

Is there anyone with the same problem? How did you fix it?

like image 484
Fil Avatar asked Mar 28 '21 12:03

Fil


1 Answers

ubuntu doesn't like the fact that you are trying to write files in /mnt/c. Since WSL doesn't always tie in correctly with ubuntu's permission systems, even with sudo you cannot change the permissions of those files.

I'd recommend changing directories to somewhere you know your user has ownership of (e.g. your documents library or usr/foldername), and trying again.

like image 113
Akhil Avatar answered Nov 15 '22 13:11

Akhil