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

paraglide-js not working #12777

Closed
PatrykWalach opened this issue Jul 24, 2024 · 21 comments
Closed

paraglide-js not working #12777

PatrykWalach opened this issue Jul 24, 2024 · 21 comments
Labels
bug Something isn't working needs triage

Comments

@PatrykWalach
Copy link

What version of Bun is running?

1.1.20+ae1948925

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

bun init
bunx @inlang/paraglide-js@latest init
en // or any language
bun run --bun build

I've also created a repo

"@inlang/paraglide-js": "1.11.2"

What is the expected behavior?

Running with node works bun run build
would expect for this to work in bun too

expected out:

$ paraglide-js compile --project ./project.inlang --outdir ./src\paraglide
ℹ [paraglide] Compiling inlang project at "./project.inlang".
Using existing cloned repo
ℹ [paraglide] Successfully compiled the project.

What do you see instead?

I get the error instead:

$ paraglide-js compile --project ./project.inlang --outdir ./src\paraglide
ℹ [paraglide] Compiling inlang project at "./project.inlang".
ENOENT: No such file or directory
   errno: -2
 syscall: "stat"


Bun v1.1.20 (Windows x64)
error: script "build" exited with code 1

Additional information

No response

@PatrykWalach PatrykWalach added bug Something isn't working needs triage labels Jul 24, 2024
@frankmayer
Copy link

FYI: Same command on linux (inside a bun workspace) runs, but throws a warning:
WARN Could not find repository root for path /somepath/apps/my-app/project.inlang

But in a basic SvelteKit project (inside a bun workspace), having installed paraglide according to its instructions, running

bun --bun run dev
throws:

ENOENT: No such file or directory
   errno: -2
 syscall: "stat"

(same as above)

while
bun run dev (node mode)
starts the dev environment normally

Not sure, if it's triggered by the same issue, but I thought it's worth mentioning.

@Droidion
Copy link

Droidion commented Oct 30, 2024

Still a problem on bun 1.1.33 and @inlang/paraglide-js 1.11.3

@tobyspark
Copy link

Like above, the Sveltekit + bun workflow fails for me on including paraglide, with the uninformative ENOENT. I’ve dug into paraglide, and there’s a lot of filesystem code in there, including a nodeishFS wrapper and fs.stat calls... but some naive logging hasn’t hit the code path that’s failing. (Bun 1.1.34, Paraglide 1.11.3)

But for Bun, what I don’t understand is why I seemingly can’t get debug info from the crash. I can’t find any verbose flags, and e.g. bun --bun --inspect-brk dev is not waiting for a debugger to attach.

ps. On Apple Silicon I can neither run the SvelteKit + Bun example with node (bun devCannot find module @rollup/rollup-darwin-x64) nor Bun (bun --bun dev, this issue).

@samuelstroschein
Copy link

Adding context to the filesystem calls in paraglide js:

  • paraglide v1 uses "git as a backend" (mostly for apps like Fink or Sherlock)
  • the filesystem calls are wrapped in a nodeish like fs interface to enable in memory fs implementations in the browser
  • i assume the wrapping might be the issue
  • the wrapping is gone in paraglide js v2 which will be released sometime early 2025

@fubits1
Copy link

fubits1 commented Jan 13, 2025

I found a ~workaround (with Bun v1.1.31):

  • use pnpm to install and to run the build task
  • continue to use Bun to run the build
  • pnpm needs Node to install sharp (at least in my case where I'm using Nixpacks)

My nixpacks.toml:

[phases.setup]
# https://github.com/NixOS/nixpkgs/commits/master/pkgs/development/web/bun/default.nix
# https://github.com/NixOS/nixpkgs/commit/c29012c10c2a8d2ad65702f560c77cc7004a1cf9
nixpkgsArchive = 'c29012c10c2a8d2ad65702f560c77cc7004a1cf9'
nixPkgs = ['nodejs_22', 'pnpm', 'bun'] 

[phases.install]
cmds = ['pnpm i']

[phases.build]
cmds = ['pnpm build']

[start]
cmd = 'bun run start'

@samuelstroschein
Copy link

@fubits1 can you try the Paraglide JS 2.0 beta?

  • no more dependency on isomorphic git
  • uses regular node:fs
  • should work in bun

@lesjul
Copy link

lesjul commented Jan 14, 2025

@samuelstroschein I'd like to try it out on my SvelteKit app. Could you provide a documentation to migrate into v2 with SvelteKit please ?

@samuelstroschein
Copy link

I will update the SvelteKit adapter this week. Migration should be non-breaking.

lesjul added a commit to lesjul/panel-wholesaler that referenced this issue Jan 21, 2025
@PatrykWalach
Copy link
Author

PatrykWalach commented Jan 22, 2025

@inlang/[email protected] works fine in node

In [email protected] or [email protected] it shows [paraglide] Successfully compiled the project.
but the generated messages.js is empty (there are no imports, just comments at the top)

@lesjul
Copy link

lesjul commented Jan 26, 2025

@samuelstroschein Hello, have you updated the sveltekit-adapter ?

@oskar-gmerek
Copy link

@lesjul https://github.com/opral/monorepo/tree/main/inlang/packages/paraglide/paraglide-sveltekit

@lesjul
Copy link

lesjul commented Jan 27, 2025

@oskar-gmerek Have you tried yet on Sveltekit ?

I cannot find paraglideAdapter when I try to import it.

import * as paraglideAdapter from '$lib/paraglide/adapter';

@oskar-gmerek
Copy link

oskar-gmerek commented Jan 27, 2025

@lesjul That file will be generated by paraglide. Just setup everything like in the README.md and run bun run dev (or equivalent) and this file should be generated.

@lesjul
Copy link

lesjul commented Jan 27, 2025

@oskar-gmerek
I ran bun add @inlang/paraglide-sveltekit@beta then bun dev

and I get this error:

Image

vite.config.ts

Image

@oskar-gmerek
Copy link

oskar-gmerek commented Jan 27, 2025

@lesjul Remove node_modules, .svelte-kit, build folders and try again.

As you can see in the error, there is complain about paraglideVitePlugin that is not exported from paraglide-js. It must be in cache, as you clearly do not import it in your vite.config.ts.(if the screenshot showing whole file)

@lesjul
Copy link

lesjul commented Jan 27, 2025

@oskar-gmerek I still get this error

@oskar-gmerek
Copy link

@lesjul try to remove 'bun.lock'/'bun.lockb' as well as 'node_modules' and try again.

@samuelstroschein
Copy link

@lesjul did you update @inlang/paraglide-js to a v2 beta version as well? you might be running on v1. (the adapter, and paraglide js are updated independently)

Image

@lesjul
Copy link

lesjul commented Jan 27, 2025

@samuelstroschein Thank you, it was the issue.

@samuelstroschein
Copy link

Works with Paraglide JS 2.0-beta.16. I think this can be closed :)

Image

@PatrykWalach
Copy link
Author

Works for me as well with bun 1.2.2 and paraglide 2.0.0-beta.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

8 participants