blockfrost / blockfrost-backend-ryo

Blockfrost API backend. You can now Run-Your-Own.
Apache License 2.0
68 stars 17 forks source link

install issue: Nix does not find rimraf, tsc etc. #103

Closed lemmon-714 closed 1 year ago

lemmon-714 commented 1 year ago

On a fresh Ubuntu 22.10 instance, I tried install via cloning and running "nix run". This yielded:

error: builder for '/nix/store/7izay7wmrs2cdcggjafylvlk2577mj72-blockfrost-backend-ryo.drv' failed with exit code 127;
       last 10 log lines:
       > ➤ YN0000: └ Completed in 0s 409ms
       > ➤ YN0000: ┌ Fetch step
       > ➤ YN0013: │ 915 packages were already cached
       > ➤ YN0000: └ Completed in 0s 664ms
       > ➤ YN0000: ┌ Link step
       > ➤ YN0007: │ esbuild@npm:0.16.17 must be built because it never has been before or the last one failed
       > ➤ YN0000: └ Completed in 15s 747ms
       > ➤ YN0000: Done with warnings in 17s 158ms
       > building
       > command not found: rimraf  (note: or tsc, see below)

I tried various combinations of yarn install, npm install, lock file deleting, and removing rimraf from the package.json - which then resulted in the same error for tsc instead; as I've tried installing rimraf globally before, I suspect this is a nix issue, which I am unable to figure out myself.

another one I arrived at is:

error: builder for '/nix/store/l8i7zas8hzsn7hhgasd5bdj2c4n8bhvk-blockfrost-backend-ryo.drv' failed with exit code 1;
       last 10 log lines:
       > ➤ YN0056: │ tapable@npm:2.2.1: Cache entry required but missing for tapable@npm:2.2.1
       > ➤ YN0056: │ terser-webpack-plugin@npm:5.3.8: Cache entry required but missing for terser-webpack-plugin@npm:5.3.8
       > ➤ YN0056: │ terser@npm:5.17.3: Cache entry required but missing for terser@npm:5.17.3
       > ➤ YN0056: │ update-browserslist-db@npm:1.0.11: Cache entry required but missing for update-browserslist-db@npm:1.0.11
       > ➤ YN0056: │ watchpack@npm:2.4.0: Cache entry required but missing for watchpack@npm:2.4.0
       > ➤ YN0056: │ webpack-sources@npm:3.2.3: Cache entry required but missing for webpack-sources@npm:3.2.3
       > ➤ YN0056: │ webpack@npm:5.82.1: Cache entry required but missing for webpack@npm:5.82.1
       > ➤ YN0013: │ 936 packages were already cached, 55 had to be fetched
       > ➤ YN0000: └ Completed in 0s 865ms
       > ➤ YN0000: Failed with errors in 1s 500ms
       For full logs, run 'nix log /nix/store/l8i7zas8hzsn7hhgasd5bdj2c4n8bhvk-blockfrost-backend-ryo.drv'.

... and also failed at installing those manually with yarn. Npm install yields

npm ERR! 404 Not Found - GET https://registry.npmjs.org/0.16.17 - Not found
lemmon-714 commented 1 year ago

Update: nix-shell, yarn install and yarn start appear to be working. Leaving the issue open as it's not the approach in the readme.

lemmon-714 commented 1 year ago

Update: local docker build appears to be working, so I'll roll with that. EDIT: retracting that -

...
#0 1688.9 ➤ YN0056: │ @xtuc/ieee754@npm:1.2.0: Cache entry required but missing for @xtuc/ieee754@npm:1.2.0
#0 1688.9 ➤ YN0056: │ @xtuc/long@npm:4.2.2: Cache entry required but missing for @xtuc/long@npm:4.2.2
#0 1688.9 ➤ YN0056: │ acorn-import-assertions@npm:1.8.0: Cache entry required but missing for acorn-import-assertions@npm:1.8.0
#0 1688.9 ➤ YN0056: │ acorn@npm:8.8.2: Cache entry required but missing for acorn@npm:8.8.2
#0 1688.9 ➤ YN0056: │ ajv-keywords@npm:3.5.2: Cache entry required but missing for ajv-keywords@npm:3.5.2
#0 1688.9 ➤ YN0056: │ base64-js@npm:1.5.1: Cache entry required but missing for base64-js@npm:1.5.1
#0 1688.9 ➤ YN0056: │ browserslist@npm:4.21.5: Cache entry required but missing for browserslist@npm:4.21.5
#0 1688.9 ➤ YN0056: │ buffer@npm:6.0.3: Cache entry required but missing for buffer@npm:6.0.3
#0 1688.9 ➤ YN0056: │ caniuse-lite@npm:1.0.30001486: Cache entry required but missing for caniuse-lite@npm:1.0.30001486
#0 1688.9 ➤ YN0056: │ chrome-trace-event@npm:1.0.3: Cache entry required but missing for chrome-trace-event@npm:1.0.3
#0 1688.9 ➤ YN0056: │ commander@npm:2.20.3: Cache entry required but missing for commander@npm:2.20.3
#0 1688.9 ➤ YN0056: │ core-js@npm:3.30.2: Cache entry required but missing for core-js@npm:3.30.2
#0 1689.0 ➤ YN0056: │ electron-to-chromium@npm:1.4.389: Cache entry required but missing for electron-to-chromium@npm:1.4.389
#0 1689.0 ➤ YN0056: │ enhanced-resolve@npm:5.14.0: Cache entry required but missing for enhanced-resolve@npm:5.14.0
#0 1689.0 ➤ YN0056: │ es-module-lexer@npm:1.2.1: Cache entry required but missing for es-module-lexer@npm:1.2.1
#0 1689.0 ➤ YN0056: │ esbuild@npm:0.17.18: Cache entry required but missing for esbuild@npm:0.17.18
#0 1689.0 ➤ YN0056: │ events@npm:3.3.0: Cache entry required but missing for events@npm:3.3.0
#0 1689.0 ➤ YN0056: │ glob-to-regexp@npm:0.4.1: Cache entry required but missing for glob-to-regexp@npm:0.4.1
#0 1689.0 ➤ YN0056: │ graceful-fs@npm:4.2.11: Cache entry required but missing for graceful-fs@npm:4.2.11
#0 1689.1 ➤ YN0056: │ ieee754@npm:1.2.1: Cache entry required but missing for ieee754@npm:1.2.1
#0 1689.1 ➤ YN0056: │ jest-worker@npm:27.5.1: Cache entry required but missing for jest-worker@npm:27.5.1
#0 1689.1 ➤ YN0056: │ loader-runner@npm:4.3.0: Cache entry required but missing for loader-runner@npm:4.3.0
#0 1689.1 ➤ YN0056: │ merge-stream@npm:2.0.0: Cache entry required but missing for merge-stream@npm:2.0.0
#0 1689.1 ➤ YN0056: │ node-releases@npm:2.0.10: Cache entry required but missing for node-releases@npm:2.0.10
#0 1689.2 ➤ YN0056: │ schema-utils@npm:3.1.2: Cache entry required but missing for schema-utils@npm:3.1.2
#0 1689.2 ➤ YN0056: │ serialize-javascript@npm:6.0.1: Cache entry required but missing for serialize-javascript@npm:6.0.1
#0 1689.3 ➤ YN0056: │ supports-color@npm:8.1.1: Cache entry required but missing for supports-color@npm:8.1.1
#0 1689.3 ➤ YN0056: │ tapable@npm:2.2.1: Cache entry required but missing for tapable@npm:2.2.1
#0 1689.3 ➤ YN0056: │ terser-webpack-plugin@npm:5.3.8: Cache entry required but missing for terser-webpack-plugin@npm:5.3.8
#0 1689.3 ➤ YN0056: │ terser@npm:5.17.3: Cache entry required but missing for terser@npm:5.17.3
#0 1689.3 ➤ YN0056: │ update-browserslist-db@npm:1.0.11: Cache entry required but missing for update-browserslist-db@npm:1.0.11
#0 1689.3 ➤ YN0056: │ watchpack@npm:2.4.0: Cache entry required but missing for watchpack@npm:2.4.0
#0 1689.3 ➤ YN0056: │ webpack-sources@npm:3.2.3: Cache entry required but missing for webpack-sources@npm:3.2.3
#0 1689.3 ➤ YN0056: │ webpack@npm:5.82.1: Cache entry required but missing for webpack@npm:5.82.1
#0 1689.4 ➤ YN0013: │ 936 packages were already cached, 55 had to be fetched
#0 1689.4 ➤ YN0000: └ Completed in 0s 779ms
#0 1689.4 ➤ YN0000: Failed with errors in 1s 402ms
#0 1691.1 error: builder for '/nix/store/2w5m0jb8bms8p3dq0bhqhrira2dr0fcb-blockfrost-backend-ryo.drv' failed with exit code 1
------
Dockerfile:4
--------------------
   2 |     COPY . /app
   3 |     WORKDIR /app
   4 | >>> RUN nix-build -A blockfrost-backend-ryo
   5 |     RUN ln -s $(nix-build -A blockfrost-backend-ryo --no-out-link)/bin/blockfrost-backend-ryo /app/blockfrost-backend-ryo
   6 |     ENTRYPOINT ["/app/blockfrost-backend-ryo"]
--------------------
ERROR: failed to solve: process "/bin/sh -c nix-build -A blockfrost-backend-ryo" did not complete successfully: exit code: 100
lemmon-714 commented 1 year ago

A simple nix run in a fresh nixos/nix docker instance also does the trick.

sorki commented 1 year ago

A simple nix run in a fresh nixos/nix docker instance also does the trick.

To reproduce the issue?

I've tried different machines and Ubuntu 20.04 VM with freshly installed Nix and cannot seem to be able to reproduce - both master and custom-network work for me with nix run. Are you possibly on Darwin? (I'm testing on x86)

lemmon-714 commented 1 year ago

To reproduce the issue? Are you possibly on Darwin?

No, to get it to work as intended. Current setup is Ubuntu 22.10, running a vanilla nix/nixos docker, in which I am following the instructions of this repo successfully.

It appears that with mere Ubuntu 22.10 & nix the yarn setup fails somehow. Manually running yarn/node install didn't work as well, and I would not expect them to do the trick either, as I assume nix wants to have the stuff in the nix system anyways, not the ubuntu one.

lemmon-714 commented 1 year ago

I want to note that running the dockers - both from hub and built within the nixos-docker, then exported to ubuntu - works.

sorki commented 1 year ago

Cool! Regarding the shell troubles - nix-shell (or more recent nix develop alternative) should put you in a shell where all the dependencies are available and you should be able to just run for example yarn run dev to start the server which uses config/development.yaml.

lemmon-714 commented 1 year ago

Right, so the mistake was that I did not parse "Nix" to mean "either Nixos or nix shell" but only as "either Nixos or Unix with Nix installed". However it still does not work that way - nix develop installs a bunch of stuff, then, without error, just gives me back the regular shell; nix-shell gives some warnings, then the same rimraf-error when running nix run. Note that this is tested on the custom-network branch.

I am as I said before working with the docker anyways now, so I don't have a need to be able to build it myself. Leaving the issue open since technically etc., but from my side it can be closed for now. Thank you for the assistance.

lemmon-714 commented 1 year ago

a simple docker build without touching anything nix works as well (need to build the custom-network branch docker, hence). I don't know why it failed before, this time I did a fresh clone & checkout custom-network.

sorki commented 1 year ago

Update: nix-shell, yarn install and yarn start appear to be working. Leaving the issue open as it's not the approach in the readme.

Found out we have this in CONTRIBUTING.md, so closing this.