I am building an Electron application and I am using webContents.executeJavaScipt() which is pretty much a eval() for the Electron browser. I never had a problem until we put the project on my clients Windows computer and this is the error:
module.js:472 Uncaught Error: Cannot find module 'C:UsersMichael Bruce AllenDocumentsGitHubschedule-crawl
enderer
emoteItems.js'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (C:\Users\Michael Bruce Allen\Documents\GitHub\schedule-crawl\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at <anonymous>:3:25
at EventEmitter.electron.ipcRenderer.on (C:\Users\Michael Bruce Allen\Documents\GitHub\schedule-crawl\node_modules\electron\dist\resources\electron.asar\renderer\init.js:52:28)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:201:7)
To me it seems like an escaping issue to me. So I broke this down as simple as possible and I would like to know what is happening here:
const path = require('path');
const projectPath = `
console.log('${path.join(__dirname, "project_path")}');
`;
eval(projectPath);
I get on WINDOWS: (clearly wrong)
C:UsersMichael Bruce AllenDocumentsGitHubsandboxproject
On LINUX: (Looks beautiful)
/home/codeamend/Coding/projects/work/upwork/schedule-crawl/journal/learning/project_path