Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Can't find axios module ? Module build failed: Error: ENOENT: no such file or directory

I'm getting the following error in my laravel-vue app:

Error: Module build failed: Error: ENOENT: no such file or directory, open 'C:\xampp\htdocs\candemtown.es\node_modules\axios\index.js

Pretty weird considering I can see the file is there, I tried deleting node_modules and package-lock.json and doing a npm install again but I keep getting the error.

My package.json file:

{
    "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 --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": {
        "@babel/plugin-syntax-dynamic-import": "^7.2.0",
        "babel-eslint": "^8.2.6",
        "babel-plugin-dynamic-import-webpack": "^1.1.0",
        "babel-preset-env": "^1.7.0",
        "bootstrap": "^4.0.0",
        "cross-env": "^5.1",
        "laravel-mix": "^4.0.15",
        "popper.js": "^1.12",
        "resolve-url-loader": "^2.3.2",
        "sass": "^1.17.2",
        "sass-loader": "^7.1.0"
    },
    "dependencies": {
        "axios": "^0.18.1",
        "chart.js": "^2.8.0",
        "jquery": "^3.4.1",
        "lodash": "^4.17.15",
        "vue": "^2.6.8",
        "vue-moment": "^4.1.0",
        "vue-parallaxy": "^1.1.1",
        "vue-slick": "^1.1.15",
        "vue-template-compiler": "^2.6.8",
        "vue2-datepicker": "^2.6.4",
        "vue2-editor": "^2.6.6",
        "vuex": "^3.1.0",
        "vuex-persistedstate": "^2.5.4"
    }
}

0 likes
4 replies
tykus's avatar

How are you attempting to import and use axios in your project?

gokyo66's avatar

Got the same issue ... and all of a sudden... I was working properly with a Vue component that use Axios to send and retrieve data and stop to worked... didn't display data anymore even thought with the Chrome Vue tools I could see that data were there. After a while I noticed this error. I tried to update axios package to the new version 0.19.2 but nothing still there.

I was trying to upgrade the application in order to use Vue in more places instead of blade, now fortunately still the actual version, that make use as well of Axios is working... and guess what... no error... but I start to freak out, because the newest version as well was properly working and stopped, apparently w/out reasons

gokyo66's avatar

I noticed btw that the error occur (in my case) once you add in your page the app.js script src="{{ asset('js/app.js') }}">

gokyo66's avatar

Just for info, watching a Larcast video I realized that I could try to run the command npm run dev fixed the problem. Hope cand solve your issue as well

Please or to participate in this conversation.