1

What I have:

  1. macOS Big Sur
  2. node 14 with nvm ( I have also try the 17 )
  3. npm 8.1.3
  4. Laravel 8

package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
  },
  "devDependencies": {
    "axios": "^0.21.4",
    "babel-loader": "^8.2.3",
    "bootstrap": "^4.6.0",
    "jquery": "^3.6",
    "laravel-mix": "^6.0.6",
    "lodash": "^4.17.19",
    "mini-css-extract-plugin": "^2.4.5",
    "popper.js": "^1.16.1",
    "postcss": "^8.1.14",
    "resolve-url-loader": "^3.1.2",
    "sass": "^1.32.11",
    "sass-loader": "^11.0.1",
    "vue": "^2.6.12",
    "vue-loader": "^15.9.8",
    "vue-template-compiler": "^2.6.12"
  },
  "dependencies": {
    "vuetify": "^2.6.0"
  }
}

What I have do:

npm i

npm run dev // or npm run watch or npm run production, same error

The error ( Module build failed for babel-loader and mini-css-extract-plugin ):

ERROR in ../../../../Websites_#02/websites/dev.crost.it/src/resources/js/app.js
Module build failed: Error: Cannot find module '/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/babel-loader/lib/index.js'
Require stack:
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/ProgressPlugin.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/index.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack-cli/lib/webpack-cli.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack-cli/lib/bootstrap.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack-cli/bin/cli.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/ProgressPlugin.js:412:9
    at Hook.eval [as call] (eval at create (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at Hook.CALL_DELEGATE [as _call] (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/tapable/lib/Hook.js:14:14)
    at NormalModule._doBuild (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/NormalModule.js:802:24)
    at NormalModule.build (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/NormalModule.js:956:15)
    at /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/Compilation.js:1367:12
    at NormalModule.needBuild (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/NormalModule.js:1243:32)
    at Compilation._buildModule (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/Compilation.js:1348:10)
    at /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/util/AsyncQueue.js:303:10
    at Hook.eval [as callAsync] (eval at create (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/tapable/lib/Hook.js:18:14)
    at AsyncQueue._startProcessing (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/util/AsyncQueue.js:293:26)

ERROR in ../../../../Websites_#02/websites/dev.crost.it/src/resources/sass/app.scss
Module build failed: Error: Cannot find module '/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/laravel-mix/node_modules/mini-css-extract-plugin/dist/loader.js'
Require stack:
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/ProgressPlugin.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/index.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack-cli/lib/webpack-cli.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack-cli/lib/bootstrap.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack-cli/bin/cli.js
- /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/ProgressPlugin.js:412:9
    at Hook.eval [as call] (eval at create (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at NormalModule._doBuild (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/NormalModule.js:802:24)
    at NormalModule.build (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/NormalModule.js:956:15)
    at /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/Compilation.js:1367:12
    at NormalModule.needBuild (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/NormalModule.js:1243:32)
    at Compilation._buildModule (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/Compilation.js:1348:10)
    at /Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/util/AsyncQueue.js:303:10
    at Hook.eval [as callAsync] (eval at create (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncQueue._startProcessing (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/util/AsyncQueue.js:293:26)
    at AsyncQueue._ensureProcessing (/Volumes/Websites_#02/websites/dev.crost.it/src/node_modules/webpack/lib/util/AsyncQueue.js:280:12)
    at processImmediate (node:internal/timers:464:21)

webpack compiled with 2 errors

What I have try for solve:

npm link babel-loader // npm link mini-css-extract-plugin
rm -rf node_module && rm -rf package-lock.json && npm install

Same error in all projects, i have also try:

  1. install modules globally with -g option, nothing change
  2. Remove nvm npm and reinstall with homebrew
2

1 Answer 1

0

Can you try npm install -D babel-loader @babel/core @babel/preset-env webpack?

I found this answear here: https://stackoverflow.com/a/62933979/14807111

Sign up to request clarification or add additional context in comments.

2 Comments

Thank's but nothing change ...
I am not sure, but you can have a "wrong" nodejs version for that package. try to downgrade.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.