Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package-lock.json #788

Merged
merged 1 commit into from
Nov 18, 2024
Merged

Conversation

eljamm
Copy link
Contributor

@eljamm eljamm commented Nov 18, 2024

Hello, I'm a nixpkgs contributor and I'm helping in packaging icestudio with Nix. While trying to build recent versions, I've encountered the following issue:

Installing dependencies
npm error code ENOTCACHED
npm error request to https://registry.npmjs.org/nw failed: cache mode is 'only-if-cached' but no cached response is available.
npm error Log files were not written due to an error writing to the directory: /nix/store/d5qw9bb229qvvwqmsxj7sac1ldrph5vc-icestudio-0-unstable-2024-07-11-npm-deps/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

ERROR: npm failed to install dependencies

Here are a few things you can try, depending on the error:
1. Set `makeCacheWritable = true`
  Note that this won't help if npm is complaining about not being able to write to the logs directory -- look above that for the actual error.
2. Set `npmFlags = [ "--legacy-peer-deps" ]

While applying the suggestions above in the package's derivation should have worked, the error persisted and I couldn't build it. What did work, however, was updating the project's lockfile with npm install --legacy-peer-deps.

As such, this change is mainly for fixing icestudio for nixpkgs as I don't think it will affect the current releases since the workflows already do this and on my fork all build workflows are running successfully:

@cavearr
Copy link
Member

cavearr commented Nov 18, 2024

Hi @eljamm ! first , thanks for your interest in helping building Icestudio for Nix, this is a great environment.

I don't understand well the problem you propose and the solution, as syou said if your execute the command:

npm install --legacy-peer-dep

the problems derived from package-lock.json (different versions....) should be corrected.

Could you explain better the problem and how to push the package-lock.json?

Thanks!

@eljamm
Copy link
Contributor Author

eljamm commented Nov 18, 2024

Apologies if I wasn't very clear. The root issue is that package.json and package-lock.json are out of sync.

Although this was not indicated by the the error message above, repeating the command that caused the build to fail (from npm-config-hook.sh), I'm able to reproduce the failure locally from the project's directory:

$ npm ci --ignore-scripts --legacy-peer-deps
npm error code EUSAGE
npm error
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error
npm error Invalid: lock file's [email protected] does not satisfy [email protected]
...

After syncing the lock file with npm install --legacy-peer-dep, the command no longer fails and I can build icestudio successfully:

$ npm ci --ignore-scripts --legacy-peer-deps

added 467 packages, and audited 468 packages in 6s

37 packages are looking for funding
  run `npm fund` for details
...

I said this won't be an issue for the workflows because they already sync these files before every build, which I'm not sure is something that can be done directly in nixpkgs.

@cavearr cavearr merged commit 87d057a into FPGAwars:develop Nov 18, 2024
3 of 4 checks passed
@cavearr
Copy link
Member

cavearr commented Nov 18, 2024

Very clear !!! thanks again and go ahead!!

@eljamm eljamm deleted the update-lockfile branch November 18, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants