woutdp / live_svelte

Svelte inside Phoenix LiveView with seamless end-to-end reactivity
https://hexdocs.pm/live_svelte
MIT License
1.01k stars 37 forks source link

Unable to Find Module 'esbuild' #119

Closed youfun closed 2 months ago

youfun commented 2 months ago

When attempting to run the Phoenix server using mix phx.server, the following error occurs:

Error: Cannot find module 'esbuild' ErrorDetail: Require stack:

Environment:

Operating System: Windows 10 LTSC

Elixir Version: Erlang/OTP 26 [erts-14.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] Elixir 1.16.2 (compiled with Erlang/OTP 24)

Phoenix Version: {:phoenix, "~> 1.7.1"},

esbuild Version: 0.20.2(run esbuild --version on cmd ,it show 0.20.2)

Steps to Reproduce:

way1:

git clone https://github.com/woutdp/live_svelte.git mix assets.build cd ./live_svelte/example_project npm install --prefix assets mix deps.get mix phx.server

way2: follow the lead in readme,finish all step, then Run mix phx.server.

youfun commented 2 months ago

D:\Dcode\elixir\live_svelte\example_project\assets\package.json:

{
    "devDependencies": {
        "@types/lodash": "^4.14.192",
        "dynamic-marquee": "^2.6.2",
        "esbuild": "^0.16.17",
        "esbuild-plugin-import-glob": "^0.1.1",
        "esbuild-svelte": "^0.7.4",
        "lodash": "^4.17.21",
        "stylus": "^0.55.0",
        "svelte": "^4.1.2",
        "svelte-preprocess": "^5.0.4",
        "typescript": "^4.9.5"
    },
    "dependencies": {
        "live_json": "file:../deps/live_json",
        "live_svelte": "file:../..",
        "phoenix": "file:../deps/phoenix",
        "phoenix_html": "file:../deps/phoenix_html",
        "phoenix_live_view": "file:../deps/phoenix_live_view",
        "svelvet": "^8.1.0"
    }
}
woutdp commented 2 months ago

Might be a windows issue where it doesn't run nmp install.

Try running npm install inside the assets directory

youfun commented 2 months ago

i switch dev env,dont need use win ,the i work