I have a quick question thats probably easy for experienced users. Im helping develop a game, and it uses CraftyJS. When i try to run it in Electron, Electron throws this error:
TypeError: Crafty.scene is not a function at Object.<anonymous> (/Users/gingkathfox/Desktop/Overtime-Game/Level1.js:4:8) at Object.<anonymous> (/Users/gingkathfox/Desktop/Overtime-Game/Level1.js:132:3) at Module._compile (internal/modules/cjs/loader.js:711:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10) at Module.load (internal/modules/cjs/loader.js:620:32) at tryModuleLoad (internal/modules/cjs/loader.js:559:12) at Function.Module._load (internal/modules/cjs/loader.js:551:3) at loadApplicationPackage (/Users/gingkathfox/Desktop/Overtime-Game/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js:286:12) at Object.<anonymous> (/Users/gingkathfox/Desktop/Overtime-Game/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js:327:5) at Object.<anonymous> (/Users/gingkathfox/Desktop/Overtime-Game/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js:364:3)
But when i run it through Beefy, it runs just fine. Anyone know why?
accidentally Today at 2:46 AM @GingkathFox that's good, thar means it's installed. But the error means that your app can't find the fuction you're calling. Most likely cause: crafty.js is not included in your app, you have to tell electron where it is.
How do i point Electron to
EDIT2: ive tried requiring craftyJS in
main.js, with no result. I dont know what to do anymore, ti doesnt seem like anyones encountered this error before.
FIXED: Apparently if i require CraftyJS in
Level1.js Electron will ignore
npm_modules. It seems like Electron automatically searches that folder, thats nice to know.