1

I am using a package that used to be available on NPM but since then it has been removed from NPM and GitHub.

I still have the package downloaded in my node_modules folder.

Is there a way to save that package and keep it in my node_modules? I am okay with maintaining the package myself.

It would also be great if I could sync just this specific package with Git so I can share it with my teammates.

Ansh
  • 89
  • 1
  • 10
  • 2
    Why not copy it out of your node_modules, and then publish it on github. Then use the github url in your package.json. – Steven Spungin Jun 18 '22 at 04:01
  • @StevenSpugin do I need to make changes to the package or can I literally just copy it and upload it to GitHub? – Ansh Jun 18 '22 at 08:35
  • You can just upload it as is, to your own repo. Then, npm will let you use github directly. Update the readme with a comment as well. – Steven Spungin Jun 18 '22 at 17:17

1 Answers1

2

You can use that package as a local module and install it as a package in your application.

Check this out: Local dependency in package.json

Ebrahim Khalil Amid
  • 398
  • 1
  • 4
  • 12
  • Would I just use npm link in that case or keep the package in the root directory and just use npm install with a direct path to the package? – Ansh Jun 18 '22 at 08:33
  • npm link does not add in package.json dependencies: []... You can store that package/module anywhere on your PC, and npm install path/to/mymodule. It will install it in node_modules like other packages. Any changes in that local module will be synced automatically to your project. – Ebrahim Khalil Amid Jun 18 '22 at 08:59
  • This works. Just needed to do `npm install --save ../path/to/mymodule`. Example: `npm install --save ../Downloads/MyPackage` – Ansh Jul 03 '22 at 01:16