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

Dev: Invalid module "node_modules/bin/vite-ssr" on Windows #3

Open
leomp12 opened this issue Aug 2, 2021 · 5 comments
Open

Dev: Invalid module "node_modules/bin/vite-ssr" on Windows #3

leomp12 opened this issue Aug 2, 2021 · 5 comments

Comments

@leomp12
Copy link

leomp12 commented Aug 2, 2021

Okay, I know Windows sucks for development, but we're building some things that must also run on Windows 😞

npm run dev on Windows 10 brokes with the error:

TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "~/node_modules/.bin/vite-ssr"

node_modules/.bin/vite-ssr file exists but is not a JS module (and shouldn't be I guess).

Any ideas? May be an issue of https://github.com/antfu/vitesse itself?

@leomp12 leomp12 changed the title Dev: Invalid module "s/.bin/vite-ssr" Dev: Invalid module "node_modules/bin/vite-ssr" on Windows Aug 2, 2021
@leomp12
Copy link
Author

leomp12 commented Aug 2, 2021

Tested using node v14.17.3 + npm 6.14.13 and also node v16.6.0 + npm 7.19.1, both terminating with same error.

@frandiox
Copy link
Owner

frandiox commented Aug 3, 2021

@leomp12 Can you try modifying node_modules/.bin/vitedge, line 66 from args.unshift('node_modules/.bin/vite-ssr') to args.unshift('./node_modules/.bin/vite-ssr') (adding ./)?

I don't use windows so I'm not sure if that will fix it 🤔

@leomp12
Copy link
Author

leomp12 commented Aug 5, 2021

@frandiox sorry for the delay, I was not using Windows past days.
Now I can't because the line doesn't exists here 😄

$ cat node_modules/.bin/vitedge
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node" ]; then
  "$basedir/node"  "$basedir/../vitedge/bin/cli.js" "$@"
  ret=$?
else
  node  "$basedir/../vitedge/bin/cli.js" "$@"
  ret=$?
fi
exit $ret

node_modules/.bin/vitedge is also not a JS module here, it's a shell script (and so doesn't work on Windows PowerShell) 😐

@frandiox
Copy link
Owner

@leomp12 Oh wow, some NPM/Windows magic. In that case, please check node_modules/vitedge/bin/cli.js.

@LittleSound
Copy link

I have downloaded this repository and am having this problem as well. The system I am using is MacOS.

image

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

3 participants