frandiox/vitessedge-template

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

Opened this issue ยท 5 comments

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?

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.

@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 ๐Ÿค”

@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) ๐Ÿ˜

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

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

image