Electron-vue: Uncaught Error: Cannot find module 'axios'

Created on 11 Oct 2019  ·  13Comments  ·  Source: SimulatedGREG/electron-vue

Describe the issue / bug.

# where i run npm run dev, shows "Uncaught Error: Cannot find module 'axios'" in console, and the main window shows nothing.

Uncaught Error: Cannot find module 'axios' at Module._resolveFilename (module.js:543) at Function.Module._resolveFilename (/Volumes/Sites/PDD/pddmigrateclient/pddmigrateclient/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35) at Function.Module._load (module.js:473) at Module.require (module.js:586) at require (internal/module.js:11) at eval (webpack-internal:///axios:1) at Object.axios (renderer.js:1576) at __webpack_require__ (renderer.js:728) at fn (renderer.js:102) at eval (webpack-internal:///./src/renderer/main.js:3)

If visual, provide a screenshot.

#

Tell me about your development environment.
  • Node version: 12.11.1
  • NPM version:6.11.3
  • vue-cli version: (if necessary) 3.8.4
  • Operating System: MacOS Catalina

If you are looking to suggest an enhancement or feature, then feel free to remove everything above.

Most helpful comment

webpack.renderer.config.js
let whiteListedModules = ['vue','axios','vue-electron', 'vue-router', 'vuex', 'vuex-electron','element-ui']
like this......

All 13 comments

you are not install axios you can npm install axios -S just try

i meet this problem too! ,I've tried npm install axios -S ,but it not work.

i meet this problem too.
I find a proble for windows.
when I tried npm install axios -g, it needed a dependency [email protected].
I try to install, get this error:

npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64

it maybe not fit for windows.
so I try to not use axios, when creat a new project.

Yarn

$ yarn add axios

npm

$ npm install axios --save

I've tried npm install and yarn add,all not work.

I've tried npm install and yarn add,all not work.

me too

Has anyone solved it?

If you have change webpack config,look#871

Don't change webpack config
just: https://github.com/SimulatedGREG/electron-vue/issues/871#issuecomment-564302194

webpack.renderer.config.js
let whiteListedModules = ['vue','axios','vue-electron', 'vue-router', 'vuex', 'vuex-electron','element-ui']
like this......

Ran into this same issue. The whiteListedModules should probably be automatically populated based on the install script options.

webpack.renderer.config.js
let whiteListedModules = ['vue','axios','vue-electron', 'vue-router', 'vuex', 'vuex-electron','element-ui']
like this......

It's works for me, thanks!

webpack.renderer.config.js
let whiteListedModules = ['vue','axios','vue-electron', 'vue-router', 'vuex', 'vuex-electron','element-ui']
like this......
It's works for me, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kinoli picture kinoli  ·  3Comments

michalzaq12 picture michalzaq12  ·  3Comments

haomehaode picture haomehaode  ·  3Comments

Quadriphobs1 picture Quadriphobs1  ·  3Comments

blackw212 picture blackw212  ·  3Comments