简体   繁体   中英

Using D3 with Electron React app

I'm building an app using electron with electron-react-boilerplate found here https://github.com/chentsulin/electron-react-boilerplate.git , it's all working fine.

But when I am trying to use D3, electron always throws me the error zTypeError: Cannot read property 'version' of undefined. (ie : console.log(d3.version) ) zTypeError: Cannot read property 'version' of undefined. (ie : console.log(d3.version) ) .

My Config:

  • Electron 1.4.15
  • Chromium 53.0.2785.143
  • node@6.9.4 | win32 | x64
  • react 15.4.2
  • d3 4.5.0

I hope someone can help with this issue.

I simply use var d3 = require('d3'); at the top of any jsx file that requires d3. This works for both of the electron + d3 based apps that I am currently working on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM