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 in sst dev Command: Could not resolve "path-to-regexp" #4414

Open
tothgBudapest opened this issue Jul 18, 2024 · 19 comments
Open

Error in sst dev Command: Could not resolve "path-to-regexp" #4414

tothgBudapest opened this issue Jul 18, 2024 · 19 comments
Assignees

Comments

@tothgBudapest
Copy link

tothgBudapest commented Jul 18, 2024

I'm encountering an error when running the sst dev command in my Next.js project using the Serverless Stack (SST). The error message indicates that the path-to-regexp module could not be resolved. Below are the details:

tothgergo@Toth-MacBook-Pro:~/Projects/demo-ion-nextjs|⇒  npm run dev

> demo-ion-nextjs@0.1.0 dev
> sst dev next dev

SST ❍ ion 0.0.542  ready!

➜  App:        demo-ion-nextjs
   Stage:      tothgergo
   Console:    https://console.sst.dev/local/demo-ion-nextjs/tothgergo

~  Deploying

|  Error       .sst/platform/src/components/cloudflare/remix.ts:3:29: Could not resolve "path-to-regexp"

Environment:

OS: macOS
Node.js version: 22.5.0
npm version: 10.8.2
SST version: 0.0.542

Expected Behavior:
The development server should start without any errors, and the application should be deployed successfully.

Actual Behavior:
The deployment fails with the error: "Could not resolve 'path-to-regexp'".

@ZachLegros
Copy link

+1

Copy link
Contributor

thdxr commented Jul 19, 2024

does wiping the .sst folder fix this?

@thdxr thdxr self-assigned this Jul 19, 2024
@jayair
Copy link
Contributor

jayair commented Jul 19, 2024

@tothgBudapest can I see your sst.config.ts? I'm confused why the Cloudlfare Remix component is involved here.

@balintant
Copy link
Contributor

👋

@jayair actually it is an issue with Yarn 4 it seems. No matter if nodeLinker is set to node-modules vs. pnp. We are using yarn through corepack. Using pnpm instead of yarn works just fine.

@thdxr no it doesn't make a difference. See ^

@jaapmvermeer
Copy link

I am also getting this error, please advise how to resolve

@balintant
Copy link
Contributor

@jaapmvermeer what package manager do you use?

@jaapmvermeer
Copy link

npm@10.8.2
node v22.5.1

@balintant
Copy link
Contributor

We didn't have the issue with npm or pnpm, only yarn. 🙁
Do you have the issue with the base configuration? Have you modified anything? (Can you share config / output?)

@jaapmvermeer
Copy link

thanks for looking into this. I am basically trying to follow the sst guide:

  1. clone https://github.com/sst/monorepo-template
  2. change app name to notes
  3. npm install:
image
  1. make the changes to infra/api.ts , infra/storage.ts, packages/functions/src/api.ts
  2. update sst.config.ts
image

start the dev environment:
npx sst dev
image

then I try npm audit fix
image

but give other error when starting npx sst dev

image

@balintant
Copy link
Contributor

balintant commented Aug 8, 2024

@jaapmvermeer There's a bug with Node 22.5 (see nodejs/node#53934). Let me know if it works with 22.4.* or earlier.
(I'm not sure if this specific issue is related, but we had some weirdnesses that otherwise seemed unrelated.)

@jaapmvermeer
Copy link

tried with 21.7.3 and have same results. I noticed another error in the log file:

time=2024-08-08T08:52:39.834-04:00 level=ERROR msg="mutliplexer panic" err="runtime error: invalid memory address or nil pointer dereference" stack="goroutine 54 [running]:\nruntime/debug.Stack()\n\t/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/sst/ion/cmd/sst/mosaic/multiplexer.(*Multiplexer).Start.func2.1()\n\t/home/runner/work/ion/ion/cmd/sst/mosaic/multiplexer/multiplexer.go:99 +0x3f\npanic({0xb6d4920?, 0xc751a90?})\n\t/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/panic.go:770 +0x132\ngithub.com/sst/ion/cmd/sst/mosaic/multiplexer.(*Multiplexer).draw(0xc000d5a600)\n\t/home/runner/work/ion/ion/cmd/sst/mosaic/multiplexer/draw.go:63 +0xc88\ngithub.com/sst/ion/cmd/sst/mosaic/multiplexer.(*Multiplexer).Start.func2(0xc000d5a600, {0xb9d0900, 0xc000d88280}, 0xc0010b1706)\n\t/home/runner/work/ion/ion/cmd/sst/mosaic/multiplexer/multiplexer.go:193 +0x8e7\ngithub.com/sst/ion/cmd/sst/mosaic/multiplexer.(*Multiplexer).Start(0xc000d5a600)\n\t/home/runner/work/ion/ion/cmd/sst/mosaic/multiplexer/multiplexer.go:304 +0xc5\nmain.CmdMosaic.func8()\n\t/home/runner/work/ion/ion/cmd/sst/mosaic.go:184 +0x57\ngolang.org/x/sync/errgroup.(*Group).Go.func1()\n\t/home/runner/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:78 +0x56\ncreated by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1\n\t/home/runner/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:75 +0x96\n"

Attaching the log file
sst.log

@jaapmvermeer
Copy link

I wiped my Mac and started with a clean install and I no longer haver the issue. Thanks for your time and assistance.

@OliverGeorge8
Copy link

i am having the same issue +1

@OliverGeorge8
Copy link

OliverGeorge8 commented Aug 14, 2024

I wiped my Mac and started with a clean install and I no longer haver the issue. Thanks for your time and assistance.

what did you wipe exactly ?
can you provide some help writing about how you fixed it

@jaapmvermeer
Copy link

I think I had some kind of conflict with node versions, versions of node modules or other packages. I tried removing node, and all associated modules and libraries but after reinstalling I still had the issue so I decided to apply more drastic measure and using the Erase Assistant I reset my Mac to factory settings. This basically removes all content, settings, apps, user accounts and data. As I have all my files in the cloud, I only needed to reinstall some applications. This might not be the best approach for you but after a week of trying to find the underlying issue without success, this did the trick for me.

@huangyuan3h
Copy link

yes it happened when using yarn

@john20xdoe
Copy link
Contributor

Possibly related?
yarn might not be installing the dependencies inside .sst
evanw/esbuild#3060

Copy link
Contributor

thdxr commented Sep 15, 2024

the user's package manager is not responsible for anything inside .sst - we try to insure .sst/platform/node_modules is populated correctly. can you check in there if that path-to-regexp package is missing?

@thdxr thdxr transferred this issue from sst/ion Oct 21, 2024
@AElbert
Copy link

AElbert commented Nov 9, 2024

In my case the node_modules folder inside .sst did not exist and the solution was to run sst install I am using bun.

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

10 participants