0
votes

I'm running a Laravel 8 and Vue 3 project on laradock, compiling with Laravel Mix. All was working fine and I only updated the PrimeVue version.

The problem is that after running npm install and npm run dev I get the following error:

Error: Cannot find module 'p-limit'
Require stack:
- /var/www/node_modules/p-locate/index.js
- /var/www/node_modules/locate-path/index.js
- /var/www/node_modules/find-up/index.js
- /var/www/node_modules/pkg-dir/index.js
- /var/www/node_modules/import-local/index.js
- /var/www/node_modules/webpack-cli/bin/cli.js
- /var/www/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (/var/www/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/var/www/node_modules/p-locate/index.js:2:16)
    at Module._compile (/var/www/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/www/node_modules/p-locate/index.js',
    '/var/www/node_modules/locate-path/index.js',
    '/var/www/node_modules/find-up/index.js',
    '/var/www/node_modules/pkg-dir/index.js',
    '/var/www/node_modules/import-local/index.js',
    '/var/www/node_modules/webpack-cli/bin/cli.js',
    '/var/www/node_modules/webpack/bin/webpack.js'
  ]
}

The content of my package.json is:

{
    "private": true,
    "scripts": {
        "dev": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=300",
        "hot": "mix watch --hot",
        "prod": "mix --production"
    },
    "devDependencies": {
        "@vue/compiler-sfc": "^3.0.9",
        "axios": "^0.21.1",
        "bootstrap": "^4.0.0",
        "cross-env": "^5.1",
        "jquery": "^3.2",
        "laravel-mix": "^6.0.16",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.15.2",
        "sass-loader": "^8.0.0",
        "vue": "^3.0.9",
        "vue-loader": "^16.2.0",
        "webpack": "^5.23.0",
        "webpack-shell-plugin": "^0.5.0"
    },
    "name": "www",
    "dependencies": {
        "chart.js": "^3.2.1",
        "lang.js": "^1.1.14",
        "moment": "^2.29.1",
        "moment-timezone": "^0.5.33",
        "primeicons": "^4.1.0",
        "primevue": "^3.7.1",
        "push.js": "^1.0.12",
        "survey-jquery": "^1.8.48",
        "survey-knockout": "^1.8.48",
        "uuid": "^3.4.0",
        "vue-flatpickr-component": "^9.0.3",
        "vue-moment-tz": "^2.1.1",
        "vue3-chart-v2": "^0.8.1",
        "vue3-select2-component": "^0.1.7",
        "vuedraggable": "^4.0.1",
        "vuex": "^4.0.0",
        "webpack-shell-plugin-next": "^2.2.2"
    }
}

Could it be because the file package-lock.json has changed? I don't know what to do. I tried installing the p-limit package, downgrading the PrimeVue version (doesn't seem to be an issue with this one), deleting the node_modules folder and recreating again...

What can I do? Thanks in advance!

Remove the webpack dependencies. You don’t need to explicitly declare them because laravel-mix will pull in the version of Webpack (and any other dependencies) it requires. - Martin Bean