I have a vuejs2 project and I am developing it on Ubuntu. Now If I run npm run build on my development laptop and open "dist" folder from apache then the project works fine.
However, If I do the same on the server which is also an apache running on ubuntu then I get this error in browser's dev console.
Uncaught TypeError: Cannot read property 'defaults' of undefined
at vendor.1b882bb6a097de1a309b.js:7
at Object.<anonymous> (vendor.1b882bb6a097de1a309b.js:7)
at vendor.1b882bb6a097de1a309b.js:7
at Object.<anonymous> (vendor.1b882bb6a097de1a309b.js:7)
at n (manifest.120bba3efdd853ace19c.js:1)
at Object.<anonymous> (app.8ebef1e6e8368062afd1.js:1)
at n (manifest.120bba3efdd853ace19c.js:1)
at Object.<anonymous> (app.8ebef1e6e8368062afd1.js:1)
at n (manifest.120bba3efdd853ace19c.js:1)
at Object.<anonymous> (app.8ebef1e6e8368062afd1.js:1)
the npm run build command was working fine until I've installed a new package and ran npm install on server.
Also when I ran npm install on server it said that there are some vulnerabilities and to fix them just run npm audit fix --force and I did so and all the vulnerabilities were gone. Since then whenever I run npm run build the project got successfully compiled. But when I open it in the browser I get the error mentioned above.
Also there were a memory issue while compiling the project but I managed to fix it by adding swap space on server and the project started to compiling successfully. But not opening in browser.