anseki / vscode-color

Helper with GUI to generate color codes such as CSS color notations.
MIT License
97 stars 27 forks source link

Error: Cannot find module 'electron' #70

Closed phil-harmoniq closed 6 years ago

phil-harmoniq commented 6 years ago

Steps to Reproduce:

  1. Open a JSON file. (I'm trying to edit VS Code theme .json files)
  2. Set the cursor on a valid hex color code.
  3. Run "Pick Color" from the command palette.

Log (All lines): (Click menu of VS Code "Help > Toggle Developer Tools", and click "Console" tab)

console.ts:123 [Extension Host] Start child process...
console.ts:123 [Extension Host] Check version of: electron-prebuilt
console.ts:123 [Extension Host] Check version of: comma-separated-values
console.ts:123 [Extension Host] Check version of: js-yaml
console.ts:123 [Extension Host] Check version of: process-bridge
console.ts:123 [Extension Host] Try to send IPC message: 1
console.ts:123 [Extension Host] Try to send IPC message: 2
console.ts:123 [Extension Host] Try to send IPC message: 3
console.ts:123 [Extension Host] [STDERR]: module.js:340
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     throw err;
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     ^
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]: Error: Cannot find module 'electron'
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Function.Module._resolveFilename (module.js:338:15)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Function.Module._load (module.js:289:25)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Module.require (module.js:366:17)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at require (module.js:385:17)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Object.<anonymous> (/Users/phil/.vscode/extensions/anseki.vscode-color-0.4.5/lib/app.asar/main.js:3:12)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Module._compile (module.js:425:26)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Object.Module._extensions..js (module.js:432:10)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Module.load (module.js:356:32)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Function.Module._load (module.js:313:12)
t.log @ console.ts:123
console.ts:123 [Extension Host] [STDERR]:     at Function.Module.runMain (module.js:457:10)
t.log @ console.ts:123
console.ts:123 [Extension Host] Child process disconnected
console.ts:123 [Extension Host] Child process exited with code: 1
console.ts:123 [Extension Host] Error: Child process exited with code: 1
    at /Users/phil/.vscode/extensions/anseki.vscode-color-0.4.5/node_modules/process-bridge/process-bridge.js:478:19
    at ChildProcess.<anonymous> (/Users/phil/.vscode/extensions/anseki.vscode-color-0.4.5/node_modules/process-bridge/process-bridge.js:394:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
t.log @ console.ts:123
messageService.ts:126 [processBridge]: Error: Child process exited with code: 1
e.doShow @ messageService.ts:126
console.ts:123 [Extension Host] Error: Child process already exited.
    at sendIpc (/Users/phil/.vscode/extensions/anseki.vscode-color-0.4.5/node_modules/process-bridge/process-bridge.js:415:31)
    at Timeout.<anonymous> (/Users/phil/.vscode/extensions/anseki.vscode-color-0.4.5/node_modules/process-bridge/process-bridge.js:394:19)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
t.log @ console.ts:123
messageService.ts:126 [processBridge]: Error: Child process already exited.

I'm guessing this isn't a bug, and that this tool was never meant to be used in JSON files. Nevertheless, I thought that I'd bring it to your attention that this would be a really neat tool to have while working on VS Code themes. 😄

anseki commented 6 years ago

Hi @phil-harmoniq, thank you for the report. So, does that error occur in JSON file only? I guess that the error occurs regardless of whether it is JSON or not, because this extension supports JSON also.

phil-harmoniq commented 6 years ago

That's strange, it works fine in my CSS and SCSS files.

anseki commented 6 years ago

Hmm... To try, copy the JSON file into the directory that contains the CSS file, and try the command in both CSS and JSON.

phil-harmoniq commented 6 years ago

Oddly enough, that seems to do the trick. It seems it was giving me this error when I open single files (not a workspace). Thanks for helping me clear that up. 👍

anseki commented 6 years ago

I'm happy for you. :smile: Maybe, multiple Nodes were installed in your computer, and Electron was installed globally in one of Node environments. That should not be installed globally because various apps may not work by the confliction. Try to remove that. (except there are special reasons)

First, activate each Node and NPM.

npm uninstall -g electron
npm uninstall -g electron-prebuilt

An error might occur if Electron is not found in that Node. And you can ignore that.

anseki commented 6 years ago

And, can you close this issue because it was solved?

phil-harmoniq commented 6 years ago

No problem, thanks for your help.