Is makeNodeJsModule outdated on recent Node/NPM versions? #1043

Closed
opened 2023-03-15 23:49:19 +01:00 by jpverde · 5 comments
jpverde commented 2023-03-15 23:49:19 +01:00 (Migrated from github.com)

@dsalaza4 I've been struggling to update a package using recent versions of NodeJs (18+) and NPM (9+).

My main problem is that peer dependencies are not being found in the local registry created by makes: github.com/fluidattacks/makes@e8292670f4/src/args/make-node-js-modules/builder.sh (L24)

Well reading at NPM changelog I saw that now peer dependencies are being installed locally as well, not only linked (like it used to be in NPM < 6) causing this kind of problem:

127.0.0.1 - - [15/Mar/2023 17:12:15] code 404, message File not found
127.0.0.1 - - [15/Mar/2023 17:12:15] "GET /react-side-effect HTTP/1.1" 404 -
127.0.0.1 - - [15/Mar/2023 17:12:15] code 404, message File not found
127.0.0.1 - - [15/Mar/2023 17:12:15] "GET /ansi-regex HTTP/1.1" 404 -
127.0.0.1 - - [15/Mar/2023 17:12:15] code 404, message File not found
127.0.0.1 - - [15/Mar/2023 17:12:15] "GET /ansi-regex HTTP/1.1" 404 -
npm ERR! code E404
npm ERR! 404 File not found - GET http://127.0.0.1:17426/react
npm ERR! 404 
npm ERR! 404  'react@0.0.0-experimental-c8b778b7f-20220825' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

I tried to modify the codebase by removing the --registry flag and the build was successful but the modules are not being cached, causing it to do a rebuild here every time.

I've been looking for different solutions but I cannot find a way to deal with the peer dependencies without making the job to point to the remote registry. I've been reading about node2nix but it seems to not work with NodeJs 18+ yet.

Any suggestions here?

@dacevedo12 suggested taking a look at dream2nix.

@dsalaza4 I've been struggling to update a package using recent versions of NodeJs (18+) and NPM (9+). My main problem is that peer dependencies are not being found in the local registry created by makes: https://github.com/fluidattacks/makes/blob/e8292670f46604d44063a15b28799f8d9b3d1e9e/src/args/make-node-js-modules/builder.sh#L24 Well reading at NPM changelog I saw that now peer dependencies are being installed locally as well, not only linked (like it used to be in NPM < 6) causing this kind of problem: ``` 127.0.0.1 - - [15/Mar/2023 17:12:15] code 404, message File not found 127.0.0.1 - - [15/Mar/2023 17:12:15] "GET /react-side-effect HTTP/1.1" 404 - 127.0.0.1 - - [15/Mar/2023 17:12:15] code 404, message File not found 127.0.0.1 - - [15/Mar/2023 17:12:15] "GET /ansi-regex HTTP/1.1" 404 - 127.0.0.1 - - [15/Mar/2023 17:12:15] code 404, message File not found 127.0.0.1 - - [15/Mar/2023 17:12:15] "GET /ansi-regex HTTP/1.1" 404 - npm ERR! code E404 npm ERR! 404 File not found - GET http://127.0.0.1:17426/react npm ERR! 404 npm ERR! 404 'react@0.0.0-experimental-c8b778b7f-20220825' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. ``` I tried to modify the codebase by removing the `--registry` flag and the build was successful but the modules are not being cached, causing it to do a rebuild here every time. I've been looking for different solutions but I cannot find a way to deal with the peer dependencies without making the job to point to the remote registry. I've been reading about [node2nix](https://github.com/svanderburg/node2nix) but it seems to not work with NodeJs 18+ yet. Any suggestions here? @dacevedo12 suggested taking a look at [dream2nix](https://github.com/nix-community/dream2nix).
jpverde commented 2023-03-15 23:58:50 +01:00 (Migrated from github.com)

This is also related to why sometimes you have to build a package-lock.json using the --legacy-peer-deps option, which removes the installation of peer dependencies.

This is also related to why sometimes you have to build a `package-lock.json` using the `--legacy-peer-deps` option, which removes the installation of peer dependencies.
dsalaza4 commented 2023-03-16 00:54:56 +01:00 (Migrated from github.com)

If there are ways of integrating *2nix solutions so they do the heavy-lifting when it comes to providing specific lang packages, let's do that then!

If there are ways of integrating *2nix solutions so they do the heavy-lifting when it comes to providing specific lang packages, let's do that then!
kacamargo commented 2023-05-18 22:40:39 +02:00 (Migrated from github.com)

Same issue here when trying to add a package

Screenshot from 2023-05-18 15-17-21

Same issue here when trying to add a package ![Screenshot from 2023-05-18 15-17-21](https://github.com/fluidattacks/makes/assets/58668790/4202382f-239e-4206-b440-b97669447e9d)
friendglak commented 2023-09-30 06:34:04 +02:00 (Migrated from github.com)

Same problem trying to build an application.
image

Any solution?

Same problem trying to build an application. ![image](https://github.com/fluidattacks/makes/assets/81096169/0624f734-a3f2-429e-b8cb-22738c04a6a0) Any solution?
dsalaza4 commented 2024-01-04 15:42:04 +01:00 (Migrated from github.com)

We're using node2nix now.

Only node 18 is supported.

Everything in universe builds properly with this approach.

dream2nix looks pretty much abandoned.

node2nix does not look very well maintained, we'll see how we like using it.

Maybe we'll end up deprecating makeNodeJsModules and makeNodeJsEnvironment as building node_modules via nix derivations is just too complex.

We're using node2nix now. Only node 18 is supported. Everything in universe builds properly with this approach. dream2nix looks pretty much abandoned. node2nix does not look very well maintained, we'll see how we like using it. Maybe we'll end up deprecating `makeNodeJsModules` and `makeNodeJsEnvironment` as building `node_modules` via nix derivations is just too complex.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
justin/makes#1043
No description provided.