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

Writing commit message (c c), Loading "original-fs" failed #303

Open
mdboom opened this issue Jul 26, 2024 · 12 comments
Open

Writing commit message (c c), Loading "original-fs" failed #303

mdboom opened this issue Jul 26, 2024 · 12 comments

Comments

@mdboom
Copy link

mdboom commented Jul 26, 2024

Recently, I've run into this error when trying to create a commit message (c c).

Loading "original-fs" failed
Error: Cannot find module 'original-fs'
Require stack:
- /home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at i (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:3:98)
    at r.load (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:2:1637)
    at h.load (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:1:13977)
    at u (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:3:9338)
    at Object.errorback (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:3:9457)
    at h.triggerErrorback (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:1:14271)
    at /home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:1:14022
    at r.load (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:2:1654)
    at h.load (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:1:13977)
    at u (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:3:9338)
    at l._loadModule (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:3:9466)
    at l._resolve (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:4:452)
    at l.defineModule (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:3:5561)
    at Function.p [as define] (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:4:1741)
    at out-build/bootstrap-amd.js (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:4:6445)
    at /home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:1:132
    at Object.<anonymous> (/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js:4:9653)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/mdboom/.vscode-server-insiders/bin/bcbdd8e575684d6df1def9a478d645c37129c033/out/server-cli.js'
  ],
  phase: 'loading',
  moduleId: 'original-fs',
  neededBy: [ 'fs' ]
}
Here are the modules that depend on it:
[ 'fs' ]
Aborting commit due to empty commit message.

Version: 1.92.0-insider (user setup)
Commit: bcbdd8e575684d6df1def9a478d645c37129c033
Date: 2024-07-25T23:12:28.613Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631
edamagit: v0.6.61

This is on Windows, connecting to a WSL "remote".

@otaviof
Copy link

otaviof commented Aug 2, 2024

Same here, but using MacOS and Remote SSH extension 🥺

@TomasEkeli
Copy link

TomasEkeli commented Aug 5, 2024

just started experiencing this - probably a vscode update, as edamagit hasn't changed since spring this year

maybe related? microsoft/vscode-remote-release#188

microsoft/vscode-docs@f35cb2c

@robert-terbach-gcx
Copy link

i also run into this issue. for me i happens when working in a devcontainer. Stacktrace is the same as from mdboom.

@mcg
Copy link

mcg commented Aug 7, 2024

FWIW happens on rebasing as well.

@TomasEkeli
Copy link

i do all my development in devcontainers (or at least wsl or remote), but i tried to commit direct on windows with edamagit - and that still works.

this makes me suspect the error is within the vscode server?

@mqvist
Copy link

mqvist commented Aug 13, 2024

I'm stuck with this problem with WSL and devcontainers after vscode was updated to v1.92. As mentioned above, the problem seems to be that extensions cannot use the original-fs module when running on the remote server, they should fall back on using fs. A fix for this issue would be greatly appreciated.

RichardDRJ added a commit to RichardDRJ/edamagit that referenced this issue Aug 13, 2024
This change addresses kahole#303, preventing commit messages from being written in remote hosts.

In VSCode's `server-cli.js`, it checks for the `ELECTRON_RUN_AS_NODE` environment variable, and if it's present it maps the `fs` module to point to the `original-fs` module:

```javascript
(process.env.ELECTRON_RUN_AS_NODE || process.versions.electron) &&
  c.define("fs", ["original-fs"], function (r) {
    return r;
  }),
```

This module is present in Electron, but not in base NodeJS; base NodeJS is what's used by the VSCode remote server, so having this environment variable present when `code` is called from a subprocess will cause failure.

An alternative, but more involved, fix here might be to move to using `ShellExecution` or `ProcessExecution` rather than `child_process`; I expect that they will support calling `code` from a nested process, but they have a fairly different API.
@TomasEkeli
Copy link

while we're waiting for a new release - here's a version i built myself with the fix by @RichardDRJ (putting it here mostly to find it myself when i'm on a different computer)

magit-0.6.62-beta-commitfix.zip

@mqvist
Copy link

mqvist commented Aug 19, 2024

while we're waiting for a new release - here's a version i built myself with the fix by @RichardDRJ (putting it here mostly to find it myself when i'm on a different computer)

magit-0.6.62-beta-commitfix.zip

Thank you for providing a fixed version, I'm also using it for now. 👍

@pohlymorph
Copy link

pohlymorph commented Aug 19, 2024

Thanks @TomasEkeli for providing a fixed pre-release. I just checked with an installation in a dev container / working remotely and it works for me too:

Dev Containers Developer: Show All Logs
[2024-08-19T13:02:24.030Z] Dev Containers 0.380.0 over Remote - SSH 0.113.1 in VS Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9).
[...]

code --list-extensions --show-versions | code -
Extensions installed on Dev Container: xyz @ foo:
[...]
[email protected]

@v-iashin
Copy link

seems to be fixed now

@TomasEkeli
Copy link

yes, this was fixed in the most recent release. the issue can be closed

@robert-terbach-gcx
Copy link

awesome! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants