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

yarp.js does not build with Node.js version ≥ 12.22.1 #19

Closed
nunoguedelha opened this issue Jun 8, 2021 · 16 comments
Closed

yarp.js does not build with Node.js version ≥ 12.22.1 #19

nunoguedelha opened this issue Jun 8, 2021 · 16 comments
Assignees

Comments

@nunoguedelha
Copy link
Collaborator

yarp.js does not build with Node.js versions:

  • v12.22.1
  • v14.17.0
  • v16.3.0

But builds with Node.js version v4.9.1.

Steps for reproducing the issue

  • Node.js installed through NVM
    • node version: v14.17.0 (Latest LTS: Fermium)
    • npm version: v6.14.13
  • YARP installed through the superbuild sources.
    • version: 3.4.3
    • Superbuild dependencies installed through conda.
    • Superbuild commit abe2cb9, built with ProjectTags "LatestRelease".
  • yarp.js branch master, commit 56df066.

Yarp.js build failed with error:

$ cd ~/dev/yarp.js
$ npm install
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This module relies on Node.js's internals and will break at some point. Do not use it, and update to [email protected].

> [email protected] install /Users/nunoguedelha/dev/yarp.js
> cmake-js

fs.js:45
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:45:5
    at req_ (/Users/nunoguedelha/dev/yarp.js/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/nunoguedelha/dev/yarp.js/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/nunoguedelha/dev/yarp.js/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/nunoguedelha/dev/yarp.js/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `cmake-js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nunoguedelha/.npm/_logs/2021-06-07T14_15_39_766Z-debug.log

Works with...

  • node version: v4.9.1
  • npm version: v2.15.11

So the maximum Node.js supporting yarp.js is somewhere in between. We need support for knowing what is the latest LTS version supporting the current yarp.js.

@traversaro
Copy link
Member

Perhaps @Nicogene @vtikha @GiuliaDAngelo @randaz81 that used yarp.js in the last years may remember which version of node.js they used?

@GiuliaDAngelo
Copy link
Contributor

Hi @traversaro, actually any version after 4.2.2 should be fine.
Maybe, lately something changed significantly, I suggest you to try with the 4.2.2!

Let me know :)

@traversaro
Copy link
Member

Thanks @GiuliaDAngelo !

@nunoguedelha
Copy link
Collaborator Author

Thanks @GiuliaDAngelo . Actually, I had already tested with node version v4.9.1 and it works. The thing is that version is really old (3 years). Latest version is 16.3.0.

yarp.js build fails with Node.js 16.3.0, 14.17.0, 12.22.1 . I added the build output in my initial description. A new symbol primordials was introduced, breaking compatibility with yarp.js.

Could you tell me which was the latest Node.js version you guys tested with yarp.js?

@nunoguedelha nunoguedelha changed the title What is the latest Node.js compatible with yarp.js? yarp.js does not build with Node.js version ≥ 12.22.1 Jun 8, 2021
@nunoguedelha
Copy link
Collaborator Author

I've edited the issue title to be more clear.

CC @Nicogene @vtikha @GiuliaDAngelo @randaz81

@nunoguedelha
Copy link
Collaborator Author

Dug a bit more to see when the primordials object was used for the first time.

  • Searched in all project for pattern "= primordials".
  • Picked one of the files (.../node/lib/internal/bootstrap/loaders.js) matching and checked the file version history:

image

The change was introduced in commit nodejs/node@39d9221.

The latest Dubnium LTS release v10.24.1 does not use primordials.
The first Erbium LTS release v12.13.0 uses primordials.

So the latest Node.js version yarp.js ican build against is v10.24.1. Just checked that it builds ok.

@nunoguedelha
Copy link
Collaborator Author

Some background on primordials object

https://stackoverflow.com/questions/59750976/what-are-primordials-in-node-js
nodejs/node#30737
https://github.com/nodejs/node/blob/141a6e34eed05577edf43ad085a74f330d0559cb/lib/internal/per_context/primordials.js#L5-L7

// This file subclasses and stores the JS builtins that come from the VM
// so that Node.js's builtin modules do not need to later look these up from
// the global proxy, which can be mutated by users.

The primordials object is meant to be a way to guarantee that node builtin modules can access the true untampered globals instead of ones which may have been modified by users.

@GiuliaDAngelo
Copy link
Contributor

Hi @nunoguedelha, I'm sorry I can't help you more than that with this problem.
The last time I used yarp.js was 3 years ago.
But it seems you found the latest version compatible :)

@nunoguedelha
Copy link
Collaborator Author

Ah indeed, it's far 😄 . Thanks anyway.

@nunoguedelha
Copy link
Collaborator Author

Actually the build with Node.js v10.24.1 is also failing. Refer to attached log. It was previously building because of left-over files in node_modules. After cleaning it, as well as the build folder, I tried again to build yarp.js and it fails.
2021-06-09T14_38_25_486Z-debug.log

So right now we are sure it works with Node.js 4.2.2.

@nunoguedelha
Copy link
Collaborator Author

Socket.io required Node.js version

The package.json of yarp.js has the dependency socket.io set to "latest", so it installs version v4.1.2, which requires Node.js version ≥ 10.0.0. I couldn't find in the history of package.json, in the socket.io repo, the same dependency line with an older version of Node.js like v4.2.2, so I looked for it using the release dates, and found v1.5.1.

With this configuration, yarp.js build and installation are successful.

Quick Recap for Successful Install so far

@nunoguedelha nunoguedelha self-assigned this Nov 5, 2021
@nunoguedelha
Copy link
Collaborator Author

Considering:

upgrading the Yarp.js module to the latest Node.js LTS version should be considered kind of crucial. So I self-assigned this issue and moved it to the backlog. Any help (@Nicogene, @vtikha ) would be welcome.

@traversaro
Copy link
Member

Great!

@Nicogene
Copy link
Member

upgrading the Yarp.js module to the latest Node.js LTS version should be considered kind of crucial. So I self-assigned this issue and moved it to the backlog. Any help (@Nicogene, @vtikha ) would be welcome.

Unfortunately, I have no expertise in Node.js, but yes seems a good idea!

@nunoguedelha
Copy link
Collaborator Author

I think it's better to just consider here as the conclusion of this issue and open a new one for addressing #19 (comment).

@nunoguedelha
Copy link
Collaborator Author

Opened #28 for the upgrade. We can close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants