woutdp / live_svelte

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

package.json is not generated ? #140

Open chrisnaadhi opened 4 months ago

chrisnaadhi commented 4 months ago

hello, i'm trying to install in new fresh projects and got this instead image the package.json was not created then make the node said "Error: Cannot find module 'esbuild'" image

is there any wrong things i've done ? my environment :

Windows 11 Elixir 1.17.1 (compiled with Erlang/OTP 27) Phoenix 1.17.14 Node v20.12.2 Npm 10.5.0

chrisnaadhi commented 4 months ago

image side-to-side the installation left was on WSL Ubuntu right was on Windows directly

the package.json was not generated on Windows

chrisnaadhi commented 4 months ago

solved for now with copying the package.json from WSL manually then npm install on the directory manually

the unsolved / unknown problem was package.json is still not generated automatically on windows version and the install command is not executed

EricAndresen commented 3 days ago

Getting the same error on Linux (Debian) following the install instructions from the docs. It's a blocking issue for getting started.

EricAndresen commented 3 days ago

From what I've pieced together it looks like this script is run in the live_svelte.setup command, but fails due to a dependency conflict.

On mac I get the error below, but on Debian it fails silently (hence no package.json is created)

➜  livesvelte_test_app mix live_svelte.setup
-- Installing npm dependencies...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: esbuild@0.16.17
npm ERR! node_modules/esbuild
npm ERR!   dev esbuild@"^0.16.17" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer esbuild@">=0.17.0" from esbuild-svelte@0.9.0
npm ERR! node_modules/esbuild-svelte
npm ERR!   dev esbuild-svelte@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

My theory is that esbuild is pinned to 0.16 in the setup script to prevent this issue (the watch command is removed in >0.17), but that now conflicts with the esbuild dependency @0.17 in the esbuild-svelte package, so new installs are borked.

woutdp commented 3 days ago

@EricAndresen Thank you, that's correct. I've fixed this just now and released a new version 0.14.1. Let me know if things are working now. Also note, I'm planning on releasing version 0.15.0 pretty soon so keep an eye out for that one.

EricAndresen commented 3 days ago

Wow! That was so fast. I was poking around the setup script and saw it change in realtime. Thanks man! Really excited about the project.