pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lang/nodejs lang/npm problems
On 20 December 2022 11:24:21 (+00:00), Chavdar Ivanov wrote:
> Hi,
>
> I tried to install some static site generator the other day and found a few problems with the above. This is all done on a fully updated pkgsrc-current on a NetBSD 10.99.1 (amd64) host and (using the same pkgsrc tree) on a Rocky Linux 9.1. They both seem to install lang/nodejs 19.2 OK. The NetBSD system fails to install lang/npm 8.15.1 because node refuses to make use of the ipv4 DNS resolution:
> ...
>
> + node . i --ignore-scripts --no-audit --no-fund
> npm ERR! code EHOSTUNREACH
> npm ERR! syscall connect
> npm ERR! errno EHOSTUNREACH
> npm ERR! request to https://registry.npmjs.org/tap/-/tap-16.3.0.tgz failed, reason: connect EHOSTUNREACH 2606:4700::6810:1923:443 - Local (:::65478)
> ...
>
> If I install the latest npm on NetBSD using
>
> curl -qL https://www.npmjs.com/install.sh | sh
>
> it fails the same way:
>
>
> npm -d ping 130 ↵
> npm info using npm@9.2.0
> npm info using node@v19.2.0
> npm notice PING https://registry.npmjs.org/
> npm ERR! code EHOSTUNREACH
> npm ERR! syscall connect
> npm ERR! errno EHOSTUNREACH
> npm ERR! request to https://registry.npmjs.org/-/ping?write=true failed, reason: connect EHOSTUNREACH 2606:4700::6810:1923:443 - Local (:::65444)
>
> npm ERR! A complete log of this run can be found in:
> npm ERR! /root/.npm/_logs/2022-12-20T11_05_38_619Z-debug-0.log
>
> This npm also appears to fail the same way even if invoked with --dns-result-order=ipv4first. My ISP doesn't support ipv6 yet; I thought this was a network issue, but a few other Linux vms with different nodejs/npm versions were working, so it didn't look like a network-level issue.
>
> On the other hand, I can install lang/npm 8.15.1 on the Rocky Linux vm via pkgsrc, but it fails to run pointing to a missing module - one which is not required by npm 9.2:
>
>
> npm
> node:internal/modules/cjs/loader:409
> const err = new Error(
> ^
>
> Error: Cannot find module '/usr/pkg/lib/node_modules/npm/node_modules/gauge/node_modules/aproba/index.js'. Please verify that the package.json has a valid "main" entry
> at tryPackage (node:internal/modules/cjs/loader:409:19)
> at Module._findPath (node:internal/modules/cjs/loader:651:18)
> at Module._resolveFilename (node:internal/modules/cjs/loader:1025:27)
> at Module._load (node:internal/modules/cjs/loader:885:27)
> at Module.require (node:internal/modules/cjs/loader:1105:19)
> at require (node:internal/modules/cjs/helpers:103:18) at Object.<anonymous> (/usr/pkg/lib/node_modules/npm/node_modules/gauge/lib/render-template.js:3:16)
> at Module._compile (node:internal/modules/cjs/loader:1218:14)
> at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
> at Module.load (node:internal/modules/cjs/loader:1081:32) {
> code: 'MODULE_NOT_FOUND',
> path: '/usr/pkg/lib/node_modules/npm/node_modules/gauge/node_modules/aproba/package.json',
> requestPath: 'aproba'
> }
>
> Node.js v19.2.0
> ...............
>
> Finally, If I install npm 9.2.0 on the Linux system via the curl command above, it works just fine on the same network:
>
>
> # nodejs --version
> sh: nodejs: command not found
> # node --version
> v19.2.0
> # which node
> /usr/pkg/bin/node
> # npm version
> {
> npm: '9.2.0',
> node: '19.2.0',
> v8: '10.8.168.20-node.8',
> uv: '1.44.2',
> zlib: '1.2.13',
> brotli: '1.0.9',
> ares: '1.18.1',
> modules: '111',
> nghttp2: '1.51.0',
> napi: '8',
> llhttp: '8.1.0',
> openssl: '1.1.1s',
> cldr: '42.0',
> icu: '72.1',
> tz: '2022e',
> unicode: '15.0'
> }
> # npm ping
> npm notice PING https://registry.npmjs.org/
> npm notice PONG 336ms
>
> .....................
>
> Apologies for the not very clear explanation, but it appears there are two problems - npm 8.15.1 being not compatible with nodejs 19.2.0 and node 19.2.0 under NetBSD-current refusing to use the ipv4 dns records. At the moment npm appears unusable either way under NetBSD-current, whereas under Linux with pkgsrc, it works if the latest version is manually installed.
I'd like to add that under Rocky Linux if I use yarn from pkgsrc it works as expected. On NetBSD-current it fails the same way as npm,
yarn create astro
yarn create v1.22.19
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/create-astro: connect EHOSTUNREACH 2606:4700::6810:1023:443 - Local (:::65430)".
....
However:-
If I
$ export NODE_OPTIONS= --dns-result-order=ipv4first
then both npm and yarn work as expected under NetBSD-current. So for some reason the command line entry is not passed to node, or I am invoking it wrongly.
>
>
--
----
Chavdar Ivanov
Home |
Main Index |
Thread Index |
Old Index