I got this error after npm run dev
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
at new NodeError (node:internal/errors:387:5)
at validateString (node:internal/validators:162:11)
at Object.isAbsolute (node:path:1157:5)
at standardizeName (/var/www//node_modules/@babel/core/lib/config/files/plugins.js:76:15)
at resolveAlternativesHelper (/var/www//node_modules/@babel/core/lib/config/files/plugins.js:81:28)
at resolveAlternativesHelper.next (<anonymous>)
at resolveStandardizedNameForRequire (/var/www//node_modules/@babel/core/lib/config/files/plugins.js:159:16)
at resolveStandardizedName (/var/www//node_modules/@babel/core/lib/config/files/plugins.js:182:12)
at /var/www//node_modules/babel-merge/dist/index.js:24:24
at Array.find (<anonymous>)
at /var/www//node_modules/babel-merge/dist/index.js:23:28
at Array.reduce (<anonymous>)
at mergeArray (/var/www//node_modules/babel-merge/dist/index.js:20:36)
at babelMerge (/var/www//node_modules/babel-merge/dist/index.js:40:19)
at /var/www//node_modules/babel-merge/dist/index.js:60:26
at Array.reduce (<anonymous>)
at Function.value (/var/www//node_modules/babel-merge/dist/index.js:58:49)
at Function.generate (/var/www//node_modules/laravel-mix/src/BabelConfig.js:11:22)
at Object.babel (/var/www//node_modules/laravel-mix/src/config.js:123:45)
at JavaScript.webpackRules (/var/www//node_modules/laravel-mix/src/components/JavaScript.js:76:41)
at ComponentFactory.applyRules (/var/www//node_modules/laravel-mix/src/components/ComponentFactory.js:155:23)
at /var/www//node_modules/laravel-mix/src/components/ComponentFactory.js:66:48
at /var/www//node_modules/laravel-mix/src/Dispatcher.js:34:47
at Array.forEach (<anonymous>)
at Dispatcher.fire (/var/www//node_modules/laravel-mix/src/Dispatcher.js:34:28)
at Mix.dispatch (/var/www//node_modules/laravel-mix/src/Mix.js:118:25)
at WebpackConfig.buildRules (/var/www//node_modules/laravel-mix/src/builder/WebpackConfig.js:90:13)
at WebpackConfig.build (/var/www//node_modules/laravel-mix/src/builder/WebpackConfig.js:23:14)
at Object.<anonymous> (/var/www//node_modules/laravel-mix/setup/webpack.config.js:29:38)
at Module._compile (/var/www//node_modules/v8-compile-cache/v8-compile-cache.js:192:30) {
code: 'ERR_INVALID_ARG_TYPE'
}
I use Laravel/vue laravel mix, webpack.
it worked few days ago, is there any updates?
this is my webpack.mix.js
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.js('resources/js/bootstrap.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
and here is package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.5.3",
"cross-env": "^7.0.3",
"google-fonts-webpack-plugin": "^0.4.4",
"html-webpack-plugin": "^4.5.0",
"http-server": "^0.12.3",
"jquery": "^3.2",
"laravel-mix": "^5.0.7",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"prerender-spa-plugin": "^3.4.0",
"resolve-url-loader": "^3.1.2",
"sass": "^1.27.0",
"sass-loader": "^8.0.0",
"vue": "^2.6.12",
"vue-stripe-elements-plus": "^1.0.1",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"@vue-stripe/vue-stripe": "^4.2.5",
"bootstrap-vue": "^2.18.1",
"mixpanel-browser": "^2.50.0",
"moment": "^2.29.1",
"vee-validate": "^3.4.3",
"vee-validate-laravel": "^1.1.0",
"vue-analytics": "^5.22.1",
"vue-country-flag": "^2.0.1",
"vue-facebook-pixel": "^1.2.1",
"vue-meta": "^2.4.0",
"vue-mixpanel": "^1.0.7",
"vue-router": "^3.4.8",
"vue-tinymce-editor": "^1.6.2",
"vuedraggable": "^2.24.3",
"vuex": "^3.4.0"
}
}
I tried delete node_modules and package.json then install but it not worked
where to find from where going error
Happened to me today as well. Add this under your dependencies and run npm install "@babel/core": "^7.25.2",
Some package is installing the latest of @babel/core which causes the error. Adding a downgraded version in package.json fixed the issue. Hope it helps!