Electron-vue: Build Web npm run build:web

Created on 1 Jun 2018  路  6Comments  路  Source: SimulatedGREG/electron-vue

After running npm run build:web and running on an http server withhttp-server the folder dist / web I have the following error in the console and the page is blank

captura de tela 2018-06-01 as 14 56 53

  • Node version: v8.6.0
  • NPM version: 5.6.0
  • Mac OS: 10.13.4
needs-info

Most helpful comment

I have the same error:

adding in webpack.web.config.js:

node: { fs: 'empty' },

I recieve this error visiting index.html

Uncaught TypeError: n.existsSync is not a function
at Object. (web.js:14)
at Object. (web.js:14)
at c (web.js:1)
at r (web.js:1)
at Object. (web.js:14)
at c (web.js:1)
at r (web.js:1)
at Object. (web.js:14)
at c (web.js:1)
at r (web.js:1)

electron-vue: latest
s.o: windows 10 x64
node: 10.13.0
npm: 6.4.1

All 6 comments

Same here !

After running yarn build:web I got this error first :

image

I changed .electron-vue/webpack.web.config.js in my local repository after refer to https://github.com/webpack-contrib/css-loader/issues/447 :

let webConfig = {
  devtool: '#cheap-module-eval-source-map',
  entry: {
    web: path.join(__dirname, '../src/renderer/main.js')
  },
+ node: {
+   fs: 'empty'
+ },
  module: {
    rules: [...]
  }
...
}

After that yarn build:web built successfully, but I got this error in Chrome :

o.existsSync is not a function. ('o' should be 'fs' ?)

image

|OS :|Windows 10 or Ubuntu 18.04|
|:-|:-|
|Node : |v8.11.2 |
|NPM : |5.6.0|
|Others : |package.json|


Can anyone help me ? Many thanks !

I fixed it by catching the exception of require('electron').shell.openExternal(url).

The changes in my codes as follows:

src/renderer/main.js:

image

src/renderer/components/GithubCorner/index.vue:

image

Hm, on the latest version of this template I'm not running into the same error, but after looking at @CS-Tao 's suggestion we might still want to add that to the template.

I tested on Windows 10 though, and with newer versions of the template and NPM (6.4.1). If someone could confirm this is still an issue or if the fix above should be added to the template, that would be appreciated!

I have the same error:

adding in webpack.web.config.js:

node: { fs: 'empty' },

I recieve this error visiting index.html

Uncaught TypeError: n.existsSync is not a function
at Object. (web.js:14)
at Object. (web.js:14)
at c (web.js:1)
at r (web.js:1)
at Object. (web.js:14)
at c (web.js:1)
at r (web.js:1)
at Object. (web.js:14)
at c (web.js:1)
at r (web.js:1)

electron-vue: latest
s.o: windows 10 x64
node: 10.13.0
npm: 6.4.1

I also have the same problem ..

The #857 says #751 has solved this problem.

after the exclusion of [electron-vuex] in the build: web environment, $ yarn run build: web can be packaged normally, and the index.html file can run normally without error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiaomizhou66 picture xiaomizhou66  路  3Comments

simdax picture simdax  路  3Comments

blackw212 picture blackw212  路  3Comments

imomaliev picture imomaliev  路  3Comments

michalzaq12 picture michalzaq12  路  3Comments