I am trying to build Async API CLI using nix but I keep running into this error
> > @asyncapi/cli@2.14.0 build
> > rimraf lib && tsc && oclif manifest && echo "Build Completed"
>
> Error: ENOENT: no such file or directory, open
> '/build/assets/examples/examples.json'
> Code: ENOENT
>
> ERROR: `npm build` failed
>
> Here are a few things you can try, depending on the error:
> 1. Make sure your build script (build) exists
> If there is none, set `dontNpmBuild = true`.
> 2. If the error being thrown is something similar to "error:0308010C:digital envelope routines::unsupported", add `NODE_OPTIONS = "--openssl-legacy-provider"` to your derivation
> See https://github.com/webpack/webpack/issues/14532 for more information.
>
For full logs, run 'nix log /nix/store/pira6m8kphsbxxr3ig89s3gw72ri9n9b-cli-2.14.0.drv'.
This is the nix expression that I am using to build it
{
lib
, stdenv
, fetchFromGitHub
, buildNpmPackage
, makeWrapper
, git
, chromium
, ...
}:
buildNpmPackage rec {
pname = "cli";
version = "2.14.0";
src = fetchFromGitHub {
owner = "asyncapi";
repo = "cli";
rev = "v${version}";
hash = "sha256-HECJelflnfAJ0rTHsu+X5QgazxZdG8Ck2Jyv5ec2Q00=";
};
npmDepsHash = "sha256-VVemfHMsM1asxLM+s1MFEzCtinzrj0bVsRKDQaBcjT0=";
npmBuildScript = "build";
patches = [./remove_example.diff ./dir_fix.diff];
nativeBuildInputs = [ git chromium ];
...
}
In one of the patches I modified the build command to stop fetching a zip file and in the other I tried to use the NIX_BUILD_TOP
environment variable to get an absolute path to the examples.json
file but that also resulted in the same error