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

Node.JS needs to be updated #2166

Closed
robert4049 opened this issue Aug 20, 2023 · 49 comments
Closed

Node.JS needs to be updated #2166

robert4049 opened this issue Aug 20, 2023 · 49 comments
Assignees
Labels
enhancement Feature or other request that adds functionality or improved usability ScRT: JS Issues/PRs related to the JavaScript scripting runtime

Comments

@robert4049
Copy link

The latest version of discord.js forces you to upgrade from version 16.

@AvarianKnight
Copy link
Contributor

It doesn't make much sense to up the node version when the next LTS releases in two months

@tabarra
Copy link
Contributor

tabarra commented Oct 28, 2023

Just to add that Discord.js as well as tRPC are not compatible with v16.9.x, and that Node.js v16 actually EOL'ed back in September due to security concerns regarding OpenSSL.

I'm eagerly looking forward to the brave and enthusiastic soul who can take on this important task, knowing that their effort will be much appreciated by many :)

@wowjeeez
Copy link

Hey, just to add to this discussion, Node.js V16 EOL'd a long time ago for multiple high severity CVEs, and many popular libraries are dropping support for the version, causing the V8 runtime to be incompatible with any of these packages.

I understand that there are a lot of moving things right now, but at the moment this bottleneck is holding back the ecosystem.

@mrclmtll
Copy link

mrclmtll commented Jan 9, 2024

Since now even Node 20.10.0 LTS is available wouldn't it be high time to update the node version of FiveM?
I mean you would have another 3 years of pause and we would be happy since the last commit to citizenfx/node was on December 20th 2021 (a29ea011b5a8073d866c57715ecd404051f907f4).

I mean the latest discord.js version which is working right now would be 12.5.3. In this version the replies are not even as you reply as a user but simply the @ of the user in front of the message.

@gottfriedleibniz gottfriedleibniz added the ScRT: JS Issues/PRs related to the JavaScript scripting runtime label Feb 1, 2024
@respectdevelopment
Copy link

Cfx. Update it :D.

@MehdiBenbahri
Copy link

I agree, the update should be done, at least to the last LTS.

@Jye-AU
Copy link

Jye-AU commented Jun 12, 2024

FiveM is running Node JS v16.9.1 which was released on the 10 Sep 2021. Node JS is now at v20.14.0 LTS . this makes it harder to create new resources for FiveM. are there any plans to update this?

Example trying to use nuxt JS
image

@thelindat
Copy link
Contributor

are there any plans to update this?

Yeah but just like all the other plans cfx make it goes to the bottom of an ever-growing list that will never be resolved.

@MehdiBenbahri
Copy link

MehdiBenbahri commented Jun 12, 2024

are there any plans to update this?

Yeah but just like all the other plans cfx make it goes to the bottom of an ever-growing list that will never be resolved.

A new hero just arise to save us from old nodeJS version :
#2479

@prikolium-cfx
Copy link
Collaborator

prikolium-cfx commented Jun 12, 2024

Let me update you with latest news.
Right now we have everything ready and testing NodeJS + client side V8 updates in-house.
I can't give you exact estimation on such update, but hope that we can deliver it to you in next 2 weeks, after proper testing.

@thelindat
Copy link
Contributor

So are we finally getting the dozen of other v8 issues that people have been asking about (to no response) resolved or at least looked at?

@prikolium-cfx
Copy link
Collaborator

So are we finally getting the dozen of other v8 issues that people have been asking about (to no response) resolved or at least looked at?

Can you please send link to these issues?

@MehdiBenbahri
Copy link

Let me update you with latest news. Right now we have everything ready and testing NodeJS + client side V8 updates in-house. I can't give you exact estimation on such update, but hope that we can deliver it to you in next 2 weeks, after proper testing.

Thanks for the news !
That will open a huge possibility for us.

@thelindat
Copy link
Contributor

And I have brought this up ~6 times in releng.
image
image

const rv = refFunctionsMap.get(ref).callback(...unpack(argsSerialized));

@VIRUXE
Copy link

VIRUXE commented Jul 1, 2024

Let me update you with latest news. Right now we have everything ready and testing NodeJS + client side V8 updates in-house. I can't give you exact estimation on such update, but hope that we can deliver it to you in next 2 weeks, after proper testing.

It's been three weeks. Could we get another update, please? Thank you.

@martonp96
Copy link

martonp96 commented Jul 8, 2024

Let me update you with latest news. Right now we have everything ready and testing NodeJS + client side V8 updates in-house. I can't give you exact estimation on such update, but hope that we can deliver it to you in next 2 weeks, after proper testing.

It's been three weeks. Could we get another update, please? Thank you.

The updates are currently being tested by the community in the experiments section.

@DemmyDemon
Copy link

The updates are currently being tested by the community in the experiments section: https://forum.cfx.re/t/nodejs-20-and-v8-update/5246559

That page is private, so linking to it is meaningless. The vast majority of the community just get the forum "lol 404 go away" page.

@martonp96
Copy link

The updates are currently being tested by the community in the experiments section: https://forum.cfx.re/t/nodejs-20-and-v8-update/5246559

That page is private, so linking to it is meaningless. The vast majority of the community just get the forum "lol 404 go away" page.

Link removed, so here is some context.
The experiments section is new and currently only a few people have access. If someone wants to try the node updates regardless, they can try to request trough this link: https://forum.cfx.re/g/experiments
Keep in mind, that its only a status update about work on node, its not forgotten. Also requesting access will not guarantee that you wil get accepted.

@robert4049
Copy link
Author

The updates are currently being tested by the community in the experiments section: https://forum.cfx.re/t/nodejs-20-and-v8-update/5246559

That page is private, so linking to it is meaningless. The vast majority of the community just get the forum "lol 404 go away" page.

Link removed, so here is some context. The experiments section is new and currently only a few people have access. If someone wants to try the node updates regardless, they can try to request trough this link: https://forum.cfx.re/g/experiments Keep in mind, that its only a status update about work on node, its not forgotten. Also requesting access will not guarantee that you wil get accepted.

Any further updates on this? I personally know of devs who have developed with the newer versions of node and have releases waiting on this update.

@jellyton255
Copy link

Any further updates on this? I personally know of devs who have developed with the newer versions of node and have releases waiting on this update.

The last word was that they were investigating an issue with performance and statebag writing and that it would be the last hurdle until it's pushed to canary, but that was a long time ago.

@FynniX
Copy link

FynniX commented Aug 27, 2024

Any update on this? Can't use current version of prisma as they need a higher version of node.

@DaniGP17
Copy link
Contributor

DaniGP17 commented Aug 27, 2024

Any update on this? Can't use current version of prisma as they need a higher version of node.

In the experimental section they have not said anything relevant about the current state, although I know that it is not the best, you can use an old version of prisma until they release this.

@tabarra
Copy link
Contributor

tabarra commented Aug 27, 2024

Don't worry guys, I know things are still in motion, it will be released when it's ready to be released (hopefully soon 😋).
Just need to be patient a little more.

@riccardoconte7904
Copy link

Hi... any news? We're still on v16, even on the lastest 11xxx fxserver build...😅 Also, why is the latest recommended build a 7xxx? Are all the latter ones unstable?

@Blumlaut
Copy link

Blumlaut commented Jan 8, 2025

chiming in to complain, one of my resources has been pinning it's dependencies to an old version for a whopping 2 years! can we please get a node version that isn't desperately out of date and EOL?

why is the latest recommended build a 7xxx? Are all the latter ones unstable?

the recommended build is almost never changed, using the latest available builds is generally preferable.

@shkssj
Copy link

shkssj commented Jan 12, 2025

Hi... any news? We're still on v16, even on the lastest 11xxx fxserver build...😅 Also, why is the latest recommended build a 7xxx? Are all the latter ones unstable?

Use this website to see the problems with the gamebuilds and choose the recommended one (with no reported issues in the last week)

https://artifacts.jgscripts.com/

@FingerlessGlov3s
Copy link

Now getting AWS SDK warnings due to them dropping 16.x support on 6th Jan 2025

Image

@tall1on
Copy link

tall1on commented Feb 16, 2025

Hey, any news? We are having MAJOR problems in our current server development as many packages no longer have node 16 support. So we have to use outdated versions with security issues.

@Guupie
Copy link

Guupie commented Feb 16, 2025

Hey everyone,

I appreciate all the work the team has put into maintaining and improving FiveM, but I wanted to check in on the status of the Node.js update. This issue has been ongoing for a long time, and it's becoming a major blocker for developers. Many essential libraries—including Prisma, AWS SDK, and Discord.js—have dropped support for Node 16, forcing us to use outdated versions that come with security vulnerabilities and lack modern features.

This isn't just about convenience; it's holding back the entire FiveM development ecosystem. Developers are struggling to build new resources, and existing ones are becoming increasingly difficult to maintain. We were last told that the update was being tested, but there haven’t been any substantial updates in a while.

Can we please get a concrete timeline for when this will be resolved? The community is more than ready to help test if needed, but we need some assurance that this update is actually coming.

Thanks for your time and all the effort you put into this project—we just really need this fix ASAP!

@Gogsi
Copy link

Gogsi commented Feb 17, 2025

Node 22 support has been merged - 6c7a573

@prikolium-cfx
Copy link
Collaborator

For now you need to use FxServer build 12913+ and set node_version '22' in your resource manifest. Node 22 will be new default in month or two if there will be no issues.

@VIRUXE
Copy link

VIRUXE commented Feb 17, 2025

Updated to 12913.
Cleaned my cache, just in case.
Added node_version '22' directive in this resource's fxmanifest.lua.

But am still getting the usual error:

[ script:yarn] Error: [yarn] error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.9.1"

@prikolium-cfx
Copy link
Collaborator

Updated to 12913. Cleaned my cache, just in case. Added node_version '22' directive in this resource's fxmanifest.lua.

But am still getting the usual error:

[ script:yarn] Error: [yarn] error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.9.1"

Are you sure that you also added that to yarn resource?

@VIRUXE
Copy link

VIRUXE commented Feb 17, 2025

You did not specify this as a requirement. But, yes, after adding node_version '22' to yarn it did work. Thank you.

@Blumlaut
Copy link

Blumlaut commented Feb 17, 2025

Are you sure that you also added that to yarn resource?

i hope this is not a permanent requirement?

Also, looks like I'm getting this when attempting to build EasyAdmin with Node22 enabled:

[         script:yarn] Error: [yarn]    musl libc (x86_64)
[         script:yarn] Version 1.2.5
[         script:yarn] Dynamic Program Loader
[         script:yarn] Usage: /home/blumlaut/fxserver/alpine/opt/cfx-server/ld-musl-x86_64.so.1 [options] [--] pathname [args]

Yarn build fails.

@prikolium-cfx
Copy link
Collaborator

Are you sure that you also added that to yarn resource?

i hope this is not a permanent requirement?

Also, looks like I'm getting this when attempting to build EasyAdmin with Node22 enabled:

[         script:yarn] Error: [yarn]    musl libc (x86_64)
[         script:yarn] Version 1.2.5
[         script:yarn] Dynamic Program Loader
[         script:yarn] Usage: /home/blumlaut/fxserver/alpine/opt/cfx-server/ld-musl-x86_64.so.1 [options] [--] pathname [args]

Yarn build fails.

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

@Blumlaut
Copy link

Blumlaut commented Feb 17, 2025

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

thanks for the feedback! i did some work and refactored my resource to use esbuild and everything seems to be working (so far), good to know that weback/yarn will be deprecated.

@FingerlessGlov3s
Copy link

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

Will there be any replacement for yarn, or is the new way forward to pack/bundle nodejs code?

@DmACKGL
Copy link

DmACKGL commented Feb 18, 2025

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

Will there be any replacement for yarn, or is the new way forward to pack/bundle nodejs code?

esbuild and Rollup are good alternatives. AFAIK you can run Husky post-merge to build the resources after the git pull

@prikolium-cfx
Copy link
Collaborator

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

Will there be any replacement for yarn, or is the new way forward to pack/bundle nodejs code?

esbuild and Rollup are good alternatives. AFAIK you can run Husky post-merge to build the resources after the git pull

You still can use any you would like, but do it in your own NodeJS environment and move baked script to resources folder.

@FingerlessGlov3s
Copy link

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

Will there be any replacement for yarn, or is the new way forward to pack/bundle nodejs code?

esbuild and Rollup are good alternatives. AFAIK you can run Husky post-merge to build the resources after the git pull

You still can use any you would like, but do it in your own NodeJS environment and move baked script to resources folder.

I was hoping to still do it part of the server startup, so I can still mantain the code within the main fivem server repo we use, but guessing nodejs resources are going to need to be moved out in to their own repos and built/bundled and copied across. From what I'm reading here.

@DmACKGL
Copy link

DmACKGL commented Feb 18, 2025

You can use preprocessing and use already built resource. Current behavior with automatic webpack/yarn will be deprecated very soon.

Will there be any replacement for yarn, or is the new way forward to pack/bundle nodejs code?

esbuild and Rollup are good alternatives. AFAIK you can run Husky post-merge to build the resources after the git pull

You still can use any you would like, but do it in your own NodeJS environment and move baked script to resources folder.

I was hoping to still do it part of the server startup, so I can still mantain the code within the main fivem server repo we use, but guessing nodejs resources are going to need to be moved out in to their own repos and built/bundled and copied across. From what I'm reading here.

There is no need, install Node in the machine and run the build command after the git pull. Remember to add a .gitignore for the builds. Another option is to create an artifact on CI/CD and download it using the pre-merge hook.

BTW: If you want to create a different repo for the resources, you can use git submodules and update the main repo when needed

@Blumlaut
Copy link

If you're really lazy, like I am, then you can simply write a github action that runs your esbuild script (or whatever you use) after pushes to a branch and commits the built files, you don't need to gitignore the output files unless you want to build them locally explicitly.
I did something similar in EasyAdmin.
Users can then just clone the resource and run it without having to manually run the build script.

@devpanda0
Copy link

Prisma will not work.
I have fixed the __dirname and __filename problem, but there comes a new error but idk why.
I hope got here more ideas on how to solve this issue

  | cfx> [         script:core] prisma:error
-- | --
  | [         script:core] Invalid `prisma.account.create()` invocation:
  | [         script:core]
  | [         script:core]
  | [         script:core] kill EPERM
  | [         script:core] Error: ~lw~[StartUp]~lr~ Failed to create test account PrismaClientKnownRequestError:
  | [         script:core] Invalid `prisma.account.create()` invocation:
  | [         script:core]
  | [         script:core]
  | [         script:core] kill EPERM
  | [         script:core]     at QE.handleRequestError (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:256:7448)
  | [         script:core]     at QE.handleAndLogRequestError (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:256:6772)
  | [         script:core]     at QE.request (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:256:6479)
  | [         script:core]     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
  | [         script:core]     at async a (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:265:9651)
  | [         script:core]     at async test (@core/server.js:63:22)

@prikolium-cfx
Copy link
Collaborator

Prisma will not work. I have fixed the __dirname and __filename problem, but there comes a new error but idk why. I hope got here more ideas on how to solve this issue

  | cfx> [         script:core] prisma:error
-- | --
  | [         script:core] Invalid `prisma.account.create()` invocation:
  | [         script:core]
  | [         script:core]
  | [         script:core] kill EPERM
  | [         script:core] Error: ~lw~[StartUp]~lr~ Failed to create test account PrismaClientKnownRequestError:
  | [         script:core] Invalid `prisma.account.create()` invocation:
  | [         script:core]
  | [         script:core]
  | [         script:core] kill EPERM
  | [         script:core]     at QE.handleRequestError (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:256:7448)
  | [         script:core]     at QE.handleAndLogRequestError (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:256:6772)
  | [         script:core]     at QE.request (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:256:6479)
  | [         script:core]     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
  | [         script:core]     at async a (G:\Development\Dysenic\fivem\fxserver\server-data\node_modules\.pnpm\@[email protected]_prisma_bf37a8d2c13df1d2415bf21b1c701e8e\node_modules\@prisma\client\runtime\binary.js:265:9651)
  | [         script:core]     at async test (@core/server.js:63:22)

Could you please provide sample resource with minimal code to reproduce this issue?

@devpanda0
Copy link

Could you please provide sample resource with minimal code to reproduce this issue?

sure give some minutes

@devpanda0
Copy link

Steps (latest fx server):

  1. copy .env.example to .env
  2. insert license key in server.cfg
  3. run pnpm i
  4. run npx prisma generate
  5. run pnpm run build:core <- 'he put it in [local]/core'
  6. run fx server

server-data.zip

@devpanda0
Copy link

are there perhaps some ideas for the problem?

@prikolium-cfx prikolium-cfx self-assigned this Feb 21, 2025
@devpanda0
Copy link

i'm fucking stupid. i forgot to check if the database exists normally prisma had always created it for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature or other request that adds functionality or improved usability ScRT: JS Issues/PRs related to the JavaScript scripting runtime
Projects
None yet
Development

No branches or pull requests