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

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function #540

Open
ThatCoolCoder opened this issue Dec 25, 2023 · 5 comments
Assignees
Labels
bug Something isn't working needs triage

Comments

@ThatCoolCoder
Copy link

Describe the bug

Hi, I just upgraded my system and I now get an error when running my project. I'm not 100% sure that this is an issue with routify itself, but the problem disappears if I remove routify from the build process so I think it's worth bringing it up here.

Reproduction

Install node (I believe I had v20 installed previously, so likely 21.x.x will reproduce this). Download the routify-starter template. npm i then npm run dev.

Logs

> [email protected] dev
> run-p dev:*


> [email protected] dev:rollup
> rollup -c -w


> [email protected] dev:routify
> routify

/home/me/coding/myproject/node_modules/esm/esm.js:1
<snip source code of that file>

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at qo (/home/me/coding/myproject/node_modules/esm/esm.js:1:223175)
    at Uo (/home/me/coding/myproject/node_modules/esm/esm.js:1:222896)
    at $o (/home/me/coding/myproject/node_modules/esm/esm.js:1:224488)
    at wu (/home/me/coding/myproject/node_modules/esm/esm.js:1:227324)
    at Eu (/home/me/coding/myproject/node_modules/esm/esm.js:1:227999)
    at Module.<anonymous> (/home/me/coding/myproject/node_modules/esm/esm.js:1:295976)
    at n (/home/me/coding/myproject/node_modules/esm/esm.js:1:279589)
    at Object.<anonymous> (/home/me/coding/myproject/node_modules/@roxi/routify/lib/utils/middleware.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

Node.js v21.4.0
rollup v2.79.1
bundles svelte-app/main.js → wwwroot/build/bundle.js...
ERROR: "dev:routify" exited with 1.

System Info

System:
    OS: Linux 6.1 Manjaro Linux
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 23.29 GB / 31.18 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 21.4.0 - /usr/bin/node
    Yarn: 1.22.21 - /usr/bin/yarn
    npm: 10.2.5 - /usr/bin/npm
    pnpm: 6.29.1 - /usr/bin/pnpm
  npmPackages:
    @roxi/routify: ^2.18.12 => 2.18.12 
    svelte: ^3.59.2 => 3.59.2
@ThatCoolCoder ThatCoolCoder added bug Something isn't working needs triage labels Dec 25, 2023
@jakobrosenberg jakobrosenberg self-assigned this Dec 25, 2023
@jakobrosenberg
Copy link
Member

This seems to be the issue: https://github.com/roxiness/routify/blob/master/lib/utils/middleware.js

I don't know if there's a way of solving it. If not, we have to consider R2 to be incompatible with Node 21.

@ThatCoolCoder
Copy link
Author

By R2 you mean routify 2.x?

@jakobrosenberg
Copy link
Member

Yes. 👍

@dunhamjared
Copy link

Had this same issue, upgrading to node v21.7.0 or above fixes the issue for me.

@nfl001
Copy link

nfl001 commented Oct 15, 2024

Happened on node v22.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

4 participants