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

Error: Invalid module “node_modules/.bin/vite-ssr” #77

Open
LittleSound opened this issue Jan 6, 2022 · 9 comments
Open

Error: Invalid module “node_modules/.bin/vite-ssr” #77

LittleSound opened this issue Jan 6, 2022 · 9 comments

Comments

@LittleSound
Copy link

Error: Invalid module “node_modules/.bin/vite-ssr”

#74 ⬅️ I had a similar problem to this in version 0.18.1
I had a problem configuring my own vitedge-time project, and then used the initial https://github.com/frandiox/vitessedge-template project as the minimum unit test, which also reproduced the problem

node: v16.13.0;
npm: 8.1.0;
system: MacOS;

TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "file:///Users/rizumu/Downloads/vitessedge-template-master/node_modules/.bin/vite-ssr" 
    at new NodeError (node:internal/errors:371:5)
    at ESMLoader.load (node:internal/modules/esm/loader:324:13)
    at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:47)
    at async link (node:internal/modules/esm/module_job:67:21) {
  code: 'ERR_INVALID_MODULE_SPECIFIER'
}

image

@Amorganskate
Copy link

Actually having the same exact issue here.

@frandiox
Copy link
Owner

frandiox commented Feb 2, 2022

I'm using Yarn in this project and haven't tested with PNPM. Can you check if any of these work?

  • pnpm install --shamefully-hoist
  • npm install --legacy-peer-deps
  • yarn (v1)

@Amorganskate
Copy link

For more context, I was working off a windows machine and having this issue. We have devs on mac and linux and not running into this issue.

@cuongvuong-phoenix
Copy link

I'm using Yarn in this project and haven't tested with PNPM. Can you check if any of these work?

  • pnpm install --shamefully-hoist
  • npm install --legacy-peer-deps
  • yarn (v1)

I'm also facing this issue even with pnpm install --shamefully-hoist and the error log is also the same as the author.

When using yarn install (v1) though, I have a different and more verbose error message as follows:

Error: Build failed with 1 error:
node_modules/vite/dist/node/chunks/dep-9c153816.js:29537:10: ERROR: [plugin: vite:dep-scan] Failed to resolve entry for package "vitedge". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "vitedge". The package may have incorrect main/module/exports specified in its package.json.
    at failureErrorWithLog (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:1605:15)
    at /home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:1251:28
    at runOnEndCallbacks (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:1036:63)
    at buildResponseToResult (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:1249:7)
    at /home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:1358:14
    at /home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:668:9
    at handleIncomingPacket (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:765:9)
    at Socket.readFromStdout (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:635:7)
    at Socket.emit (node:events:520:28)
    at Socket.emit (node:domain:475:12) {
  errors: [
    {
      detail: Error: Failed to resolve entry for package "vitedge". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "vitedge". The package may have incorrect main/module/exports specified in its package.json.
          at packageEntryFailure (/home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:29537:11)
          at resolvePackageEntry (/home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:29533:9)
          at tryNodeResolve (/home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:29349:20)
          at Context.resolveId (/home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:29166:28)
          at Object.resolveId (/home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:38271:55)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at async resolve (/home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:38474:26)
          at async /home/hello/Development/vite-ssr-project/node_modules/vite/dist/node/chunks/dep-9c153816.js:38612:34
          at async callback (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:923:28)
          at async handleRequest (/home/hello/Development/vite-ssr-project/node_modules/vite/node_modules/esbuild/lib/main.js:703:30),
      location: [Object],
      notes: [Array],
      pluginName: 'vite:dep-scan',
      text: 'Failed to resolve entry for package "vitedge". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "vitedge". The package may have incorrect main/module/exports specified in its package.json.'
    }
  ],
  warnings: []
}
Done in 1.15s.

NOTE: I setup my project just like Getting Started page suggests.

@lswebls
Copy link

lswebls commented Apr 29, 2022

Hi, I have the same issue.
node: v16.15.0;
npm: 7.6.0;
system: Windows10

Has anyone found a solution ?

@butnothero
Copy link

Hi, I have the same issue. node: v16.15.0; npm: 7.6.0; system: Windows10

Has anyone found a solution ?

I just installed WSL 2, installed nvm (node 18) on it and everything worked.
OS: Windows 10

@mikalben
Copy link

I'm facing this issue by following the Get Started guide and trying out the template at /examples/vue

RangeError [ERR_UNKNOWN_MODULE_FORMAT]: Unknown module format: null for URL file:///home/dev/my-vite-app/node_modules/.bin/vite-ssr at new NodeError (node:internal/errors:393:5) at ESMLoader.load (node:internal/modules/esm/loader:650:13) at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11) at async link (node:internal/modules/esm/module_job:67:21) { code: 'ERR_UNKNOWN_MODULE_FORMAT'

NODE: Have tried with both version 16, 18 and 19
PNPM: 7.14;
SYSTEM: Arch Linux

Any way to make this work?

@PiotrBaczkowski
Copy link

@castint
for me worked using yarn and updating ts-node
as alternative you can use vite-ssr plugin, if you look through documentation they seems to support wrangler

@ryuujo1573
Copy link

ryuujo1573 commented Dec 11, 2022

@castint for me worked using yarn and updating ts-node
as alternative you can use vite-ssr plugin, if you look through documentation they seems to support wrangler

@PiotrBaczkowski
Could you please tell me your working specifications?

e.g yarn -v, yarn list and maybe node -v

Thanks in advance.

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

9 participants