statgen / locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
https://statgen.github.io/locuszoom/
MIT License
156 stars 29 forks source link

Can't compile LocusZoom with `npm run build` #287

Closed Z-Zen closed 1 year ago

Z-Zen commented 1 year ago

Hi,

I am trying to install LocusZoom Development Setup using npm. Here's the server configuration:

~ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
~ node -v
v19.1.0
~ npm -v
8.19.3

Whether I try to clone the github code or download the release of LocusZoom, I get the following error:

~ npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated uuid@3.4.0: 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 request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 847 packages, and audited 848 packages in 6m

54 packages are looking for funding
  run `npm fund` for details

16 vulnerabilities (2 moderate, 12 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
~ npm run build

> locuszoom@0.14.0 build
> npm run echo_version && npm run test && npm run css && webpack --config webpack.prod.cjs && npm run docs

npm ERR! Cannot read properties of undefined (reading 'stdin')

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-11-24T16_53_13_112Z-debug-0.log

As for the log:

~ cat /root/.npm/_logs/2022-11-24T16_53_13_112Z-debug-0.log
0 verbose cli /root/.nvm/versions/node/v19.1.0/bin/node /root/.nvm/versions/node/v19.1.0/bin/npm
1 info using npm@8.19.3
2 info using node@v19.1.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 3ms
5 timing config:load:file:/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/Isiprod1/script/prog/locuszoom/locuszoom-0.14.0/.npmrc Completed in 1ms
10 timing config:load:project Completed in 14ms
11 timing config:load:file:/root/.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/root/.nvm/versions/node/v19.1.0/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 2ms
18 timing config:load Completed in 28ms
19 timing npm:load:configload Completed in 28ms
20 timing npm:load:mkdirpcache Completed in 2ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm run build
23 verbose argv "run" "build"
24 timing npm:load:setTitle Completed in 3ms
25 timing config:load:flatten Completed in 5ms
26 timing npm:load:display Completed in 8ms
27 verbose logfile logs-max:10 dir:/root/.npm/_logs
28 verbose logfile /root/.npm/_logs/2022-11-24T16_53_13_112Z-debug-0.log
29 timing npm:load:logFile Completed in 8ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 52ms
33 silly logfile start cleaning logs, removing 1 files
34 silly logfile done cleaning log files
35 timing command:run Completed in 17ms
36 verbose stack TypeError: Cannot read properties of undefined (reading 'stdin')
36 verbose stack     at promiseSpawnUid (/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:70:18)
36 verbose stack     at promiseSpawn (/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:14:10)
36 verbose stack     at runScriptPkg (/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js:79:13)
36 verbose stack     at runScript (/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js:9:16)
36 verbose stack     at RunScript.run (/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/lib/commands/run-script.js:126:13)
36 verbose stack     at async module.exports (/root/.nvm/versions/node/v19.1.0/lib/node_modules/npm/lib/cli.js:78:5)
37 verbose cwd /Isiprod1/script/prog/locuszoom/locuszoom-0.14.0
38 verbose Linux 4.19.0-20-amd64
39 verbose node v19.1.0
40 verbose npm  v8.19.3
41 error Cannot read properties of undefined (reading 'stdin')
42 verbose exit 1
43 timing npm Completed in 88ms
44 verbose code 1
45 error A complete log of this run can be found in:
45 error     /root/.npm/_logs/2022-11-24T16_53_13_112Z-debug-0.log

I am sorry if I missed something but I followed the installation manual provided on GitHub but was still not able to install it. Any help is really appreciated. Thank you in advance.

abought commented 1 year ago

Thanks for the bug report! I've confirmed an issue (though not the same error message as you).

My answer is in two parts: the pragmatic for now, and the longterm fix (after the thanksgiving break).

Ways to achieve your goal without compiling

First, I'll note that you generally don't need to compile LocusZoom yourself for most usages, as we provide pre-built versions via CDN: https://statgen.github.io/locuszoom/docs/guides/index.html#add-the-library-to-your-page

Second, even if you are using custom code to add a new feature, LocusZoom allows plugins to change things like how you fetch data. It's very rare that you need to edit the main source code and recompile. (if you are, it's probably because you are fixing a bug- we welcome pull requests to contribute your fix back!) https://statgen.github.io/locuszoom/docs/guides/data_retrieval.html#customizing-data-retrieval-via-subclasses

The long term fix

Currently, we pin to "an older LTS" as our default build target (a reflection of how... um... hideously out of date... many academic clusters are; we... um... find that our users appreciate this)

We do want people to be able to compile LocusZoom when needed!

It looms like some changes landed in a recent version of node. In the next week, I'll ticket the following items:

If you're having trouble installing dependencies (because of some recent changes in the webpack ecosystem), note that npm ci will respect the lockfile ("known working dependencies"), where npm install would not. That will at least allow you to create a running environment in node <=16.x.

Separately, it seems that node 17 inherited some breaking changes that affect a thing used during the build step, so even the lockfile isn't enough- we'll need to actually upgrade the webpack dependencies used to make node >= 17 work correctly.

If you need to compile your changes sooner, it should work if you use nvm to temporarily switch to node 16. I'll post to this ticket when node 19 support is verified.

abought commented 1 year ago

This should be fixed as of a0562c7. (CI is only testing active LTS versions of node, but I did verify 0.19.1 locally via nvm)

Because the changes are internal (build-focused), I have not released a corresponding 0.14.1 version; the issues we were seeing don't affect the final built asset bundle that would be incorporated into your website. The code is available on the develop branch within GitHub and will be incorporated in any eventual next release.

I'll close this ticket, but please feel welcome to reopen if you see any further issues!