Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules (dependencies) don't work: Error: Cannot find module #1519

Open
ryancwalsh opened this issue Dec 16, 2023 · 5 comments
Open

modules (dependencies) don't work: Error: Cannot find module #1519

ryancwalsh opened this issue Dec 16, 2023 · 5 comments
Labels
area:packages 🪲 bug Something isn't working ❓ more-information-needed We need a bit of information before we can work on this

Comments

@ryancwalsh
Copy link

My first fiddle attempt.

I wanted to create a fiddle to report a bug with robotjs, but I get this error even though I specified the dependency:

image

App threw an error during load
Error: Cannot find module '@jitsi/robotjs'
Require stack:
- /tmp/electron-fiddle-90379-VDHq4ptMJ80k/main.js
- /home/myname/.config/Electron Fiddle/electron-bin/current/resources/default_app.asar/main.js

https://gist.github.com/ryancwalsh/0867273c6c0199b55d2a314525f61f63

What am I doing wrong?

I'm on Ubuntu.

Thanks!!

P.S. Is there a way to use TypeScript (and import instead of require)? It's kind of a hassle to translate my code into old JavaScript.

@codebytere
Copy link
Member

codebytere commented Dec 16, 2023

@ryancwalsh see electron/electron#37535 for esm - new in latest major. Unfortunately Fiddle does not support Typescript.

This looks unfortunately like temporary npm issue or something, because i had no issues:

Saving files to temp directory...
Saved files to /var/folders/x_/clmjt4bs0dx09xjy7k3xt1z80000gn/T/electron-fiddle-26111-omLXPdxsgUql
Installing node modules using npm: @jitsi/[email protected]...
added 3 packages, and audited 4 packages in 6s

found 0 vulnerabilities
Electron v9999999999.9.9 started.
[26427:1216/101827.152797:WARNING:ca_layer_tree_coordinator.mm(61)] Blank frame: No overlays or CALayers
[26425:1216/101828.021010:ERROR:kill_posix.cc(33)] waitpid(26428): No child processes (10)

I also added:

const robot = require("@jitsi/robotjs");

console.log(robot.getScreenSize())

to main.js and saw { width: 1728, height: 1117 } printed as expected to console.

@codebytere codebytere added 🪲 bug Something isn't working ❓ more-information-needed We need a bit of information before we can work on this area:packages labels Dec 16, 2023
@ryancwalsh
Copy link
Author

@codebytere Thanks for your response!

It's still not working for me. I'm a first-time Fiddle user, so it's just an assumption, but I'd think that what you probably did was open Fiddle, paste my Gist URL into the field at the top right, press Load Fiddle, and press Run.

I tried again just now (on Ubuntu), and this is the error I get:

Saving files to temp directory...
Saved files to /tmp/electron-fiddle-3662-E4G0J9zD8827
Installing node modules using yarn: @jitsi/[email protected], [email protected]...
⚠️ Could not install modules. Error encountered:
Error invoking remote method 'NPM_ADD_MODULES': Error: Command failed: yarn add @jitsi/[email protected] [email protected]
warning package.json: No license field
warning [email protected]: No license field
error /tmp/electron-fiddle-3662-E4G0J9zD8827/node_modules/robotjs: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments: 
Directory: /tmp/electron-fiddle-3662-E4G0J9zD8827/node_modules/robotjs
Output:
prebuild-install WARN install No prebuilt binaries found (target=18.18.2 runtime=node arch=x64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"

gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/tmp/electron-fiddle-3662-E4G0J9zD8827/node_modules/robotjs/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/rcwalsh/.cache/node-gyp/18.18.2/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/rcwalsh/.cache/node-gyp/18.18.2',
gyp info spawn args '-Dnode_gyp_dir=/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/rcwalsh/.cache/node-gyp/18.18.2/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/tmp/electron-fiddle-3662-E4G0J9zD8827/node_modules/robotjs',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/node_modules/which/lib/index.js:16:17)
gyp ERR! stack at which (/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/node_modules/which/lib/index.js:77:9)
gyp ERR! stack at async doWhich (/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/lib/build.js:112:22)
gyp ERR! stack at async loadConfigGypi (/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/lib/build.js:77:7)
gyp ERR! stack at async build (/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/lib/build.js:35:3)
gyp ERR! stack at async run (/home/rcwalsh/.nvm/versions/node/v18.18.2/lib/node_modules/node-gyp/bin/node-gyp.js:81:18)
gyp ERR! System Linux 6.2.0-39-generic
gyp ERR! command "/home/rcwalsh/.nvm/versions/node/v18.18.2/bin/node" "/home/rcwalsh/.nvm/versions/node/v18.18.2/bin/node-gyp" "rebuild"
gyp ERR! cwd /tmp/electron-fiddle-3662-E4G0J9zD8827/node_modules/robotjs
gyp ERR! node -v v18.18.2
gyp ERR! node-gyp -v v10.0.1
gyp ERR! not ok

Thanks.

@ryancwalsh
Copy link
Author

Any new ideas, anyone? Thanks!

cc @codebytere

@codebytere
Copy link
Member

gyp ERR! stack Error: not found: make

This looks like your issue. You're likely missing this package on Ubuntu - once you install it the issue should likely resolve.

@ryancwalsh
Copy link
Author

Thanks for this idea, @codebytere !

Unfortunately it seems I already have make installed, so I don't know why I'm getting that error.

sudo apt-get -y install make
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
make is already the newest version (4.3-4.1build1).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.

Update: My Ubuntu laptop just froze, so after a forced restart, I tried again, and now I'm getting this error even though I do have Yarn installed according to:

yarn -v
1.22.19

Error in Fiddle:

Saving files to temp directory...
Saved files to /tmp/electron-fiddle-6122-fVdRSqXSMVbS
The modules @jitsi/[email protected], [email protected] need to be installed, but we could not find yarn. Fiddle requires Node.js and npm to support the installation of modules not included in Electron. Please visit https://nodejs.org to install Node.js and npm, or https://classic.yarnpkg.com/lang/en/ to install Yarn
Electron v27.1.3 started.
For help, see: https://nodejs.org/en/docs/inspector
App threw an error during load
Error: Cannot find module '@jitsi/robotjs'
Require stack:
- /tmp/electron-fiddle-6122-fVdRSqXSMVbS/main.js
- /home/rcwalsh/.config/Electron Fiddle/electron-bin/current/resources/default_app.asar/main.js
- 
    at node:internal/modules/cjs/loader:1084:15
    at Function._resolveFilename (node:electron/js2c/browser_init:2:116646)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/asar_bundle:2:13327)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/tmp/electron-fiddle-6122-fVdRSqXSMVbS/main.js:4:14)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
�[1m�[47m�[31mA JavaScript error occurred in the main process
�[30mUncaught Exception:
Error: Cannot find module '@jitsi/robotjs'
Require stack:
- /tmp/electron-fiddle-6122-fVdRSqXSMVbS/main.js
- /home/rcwalsh/.config/Electron Fiddle/electron-bin/current/resources/default_app.asar/main.js
- 
    at node:internal/modules/cjs/loader:1084:15
    at Function._resolveFilename (node:electron/js2c/browser_init:2:116646)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/asar_bundle:2:13327)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/tmp/electron-fiddle-6122-fVdRSqXSMVbS/main.js:4:14)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)�[0m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:packages 🪲 bug Something isn't working ❓ more-information-needed We need a bit of information before we can work on this
Projects
None yet
Development

No branches or pull requests

2 participants