router icon indicating copy to clipboard operation
router copied to clipboard

"Cannot find module cheerio-select/lib/esm/index.js Did you mean to import "css-select/lib/index.js"?

Open pierrebiver opened this issue 1 year ago • 7 comments

Which project does this relate to?

Start

Describe the bug

When trying to run vite dev, I'm getting the error:

failed to load config from /Users/pierrebiver/projects/start-basic/vite.config.ts
error when starting dev server:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/pierrebiver/projects/start-basic/node_modules/css-select/lib/esm/index.js' imported from /Users/pierrebiver/projects/start-basic/node_modules/cheerio-select/lib/esm/index.js
Did you mean to import "css-select/lib/index.js"?
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:859:10)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
    at #link (node:internal/modules/esm/module_job:170:49)

I thought it was my code, but I tried the command given on the website to test it out:

npx gitpick TanStack/router/tree/main/examples/react/start-basic start-basic
cd start-basic
npm install
npm run dev

I'm using node 24.3.0 if that could be a problem ?

Your Example Website or App

https://github.com/TanStack/router/tree/main/examples/react/start-basic

Steps to Reproduce the Bug or Issue

npx gitpick TanStack/router/tree/main/examples/react/start-basic start-basic cd start-basic npm install npm run dev

Expected behavior

It should run the server buth throw an error

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.122.0
  • Mac OS: 15.5
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Browser Version: [e.g. 91.1]
  • Bundler: vite
  • Bundler Version: 6.3.3

Additional context

No response

pierrebiver avatar Jun 28 '25 12:06 pierrebiver

I do experience this too

Ignatella avatar Jun 28 '25 13:06 Ignatella

I had the same issue. I had to force pnpm installing a lower version of css-select by adding this to my package.json

  "pnpm": {
    "overrides": {
      "css-select": "5.1.0"
    }
  }

flocks avatar Jun 28 '25 13:06 flocks

Following @flocks answer

For yarn in package.json:

 "resolutions": {
   "css-select": "5.1.0"
 }

For npm in package.json:

  "dependencies": {
    "css-select": "5.1.0"
  },
  "resolutions": {
    "css-select": "5.1.0"
  }

Ignatella avatar Jun 28 '25 13:06 Ignatella

Yea, but I think this is something that should be fixed internally. It breaks the current examples and all too right now. This solution works meanwhile

max-programming avatar Jun 28 '25 13:06 max-programming

I am also experiencing this issue..

thakuad avatar Jun 28 '25 15:06 thakuad

Yea, but I think this is something that should be fixed internally. It breaks the current examples and all too right now. This solution works meanwhile

There is already multiple issues reported to css-select package

flocks avatar Jun 28 '25 15:06 flocks

solved upstream in https://github.com/fb55/css-select/issues/1594#issuecomment-3015578625

schiller-manuel avatar Jun 28 '25 17:06 schiller-manuel