hyper
hyper copied to clipboard
Loading a Plugin locally, fail to import dependencies with "require"
- [X] I am on the latest Hyper.app version
- [X] I have searched the issues of this repo and believe that this is not a duplicate
- OS version and name: MacOS Sonoma 14.4.1
- Hyper.app version: v3.4.1
- Link of a Gist with the contents of your hyper.json: here
- Relevant information from devtools (CMD+ALT+I on macOS, CTRL+SHIFT+I elsewhere): N/A
- The issue is reproducible in vanilla Hyper.app: yes
Issue
context
I'm trying to improve a plugin (hyper-day-night-switch). To do so, I :
- forked the sources and (
index.js
,package.json
,README.md
), - added a symlink to the folder in
~/.hyper_plugins/local
, - added "hyper-day-night-switch" in my
~/.hyper.js
in thelocalPlugins
array
The problem
✅ The plugin, loads properly if I use the npmjs version (original, adding hyper-day-night-switch
into plugins
).
🔴 But won't load locally (using the forked sources, adding hyper-day-night-switch
into localPlugins
.
The devtools won't output anything. Though, I could get what's happening running hyper -v
:
Plugin error while loading "hyper-auto-dark-mode" (/Users/<me>/.hyper_plugins/local/hyper-auto-dark-mode): Cannot find module 'hyper-one-light'
Require stack:
- /Users/<me>/Documents/Projets/hyper-auto-dark-mode/index.js
- /Applications/Hyper.app/Contents/Resources/app.asar/plugins.js
- /Applications/Hyper.app/Contents/Resources/app.asar/index.js
-
The require is triggered by this line :
const light = require("hyper-one-light");
I tried adding those modules in plugins
so I know it's there : did not work.
Also tried an npm install in ~/hyper_plugins
, I can see the dependencies going into modules but, still the same issue.
NOTE
I'm not using the dev version cause on MAC I'm getting the following error, with all npm versions I tried, even though I'm not behind a proxy and I can ping the address.
EDIT : I now am, see https://github.com/vercel/hyper/issues/7913#issuecomment-2080448917
RequestError: connect EBADF 140.82.121.4:443 at ClientRequest.<anonymous> (/Users/<me>/.hyper_plugins/hyper-dev/hyper/node_modules/@electron/get/node_modules got/dist/source/core/index.js:970:111) at Object.onceWrapper (node:events:632:26) at ClientRequest.emit (node:events:529:35) at origin.emit (/Users/<me>/.hyper_plugins/hyper-dev/hyper/node_modules/@electron/get/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20) at TLSSocket.socketErrorListener (node:_http_client:501:9) at TLSSocket.emit (node:events:517:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) { code: 'EBADF',
So I managed to build hyper in dev mode on Mac OS
For anyone having the issue described in section NOTE, for me it was LuLu messing with npm, had to disable it to build
I gave up.