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

Missing "resolved" and "integrity" from lock file #59

Closed
jeslie0 opened this issue Apr 13, 2023 · 5 comments
Closed

Missing "resolved" and "integrity" from lock file #59

jeslie0 opened this issue Apr 13, 2023 · 5 comments

Comments

@jeslie0
Copy link

jeslie0 commented Apr 13, 2023

Thank you for this cool project! To make elm-watch easier to use on nix based systems, I have been trying to package this project as a nix flake. While doing that, I noticed that a lot of the dependencies listed in the packages value in package-lock.json are missing their resolved and integrity information. For example, yallist and ansi-styles. I have tried adding in these fields but it seems like there are too many missing to be able to do this by hand.

This issue of missing hashes isn't specific to elm-watch - it seems several other npm packages suffer from this issue.

The only way I could add these fields back in was to remove package-lock.json (and my local node_modules directory) and run npm install. While this does fix the missing fields, it also updates every package to the latest one, meaning my nix flake version of elm-watch isn't identical to the one you provide.

What are your thoughts about adding in the missing resolved and integrity fields, either by regenerating package-lock.json or another method?

@lydell
Copy link
Owner

lydell commented Apr 13, 2023

Hi!

I would be fine with regenerating package-lock.json.

But before we do that: Next time I update or change dependencies, how do I verify that I don’t re-introduce this issue? There must be some bug in npm causing it because I never touch package-lock.json by hand.

@jeslie0
Copy link
Author

jeslie0 commented Apr 13, 2023

Good question. I'm not entirely sure of a way that doesn't involve trying to build something with nix. It seems like the issue occurs when trying to install a package that already exists in node_modules or npm's cache (see this issue).

I will see if I can write a script that can "fix" a lock file. I really don't like the solution of having to delete the lock file - it seems to defeat the whole purpose of a lock file!

@jeslie0
Copy link
Author

jeslie0 commented Apr 14, 2023

I have made a python script that adds the missing fields into a package-lock.json. It can be found here. It's not packaged particularly well, but it does build with nix, if you use that. I will improve the python packaging over the weekend when I have a free moment.

This will allow the lock file to be updated without being deleted.

You don't have to integrate this into your workflow if you don't want to. I'm also happy to use this code to generate a patch file for my flake wrapper

@jeslie0
Copy link
Author

jeslie0 commented Apr 16, 2023

Okay, I improved the packaging of the python script. It should be usable with setuptools now.

@jeslie0
Copy link
Author

jeslie0 commented Apr 30, 2023

I'm happy to close this issue, since it isn't really an issue for normal elm-watch usage.

@jeslie0 jeslie0 closed this as completed Apr 30, 2023
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

No branches or pull requests

2 participants