How do I delete a NPM project? - npm

I pushed some junk code into npm. How do I delete the project? There's a better alternative. I don't have any users for my project yet.
Thanks!
Mike

From the man pages npm help unpublish:
DESCRIPTION
This removes a package version from the registry, deleting its entry
and removing the tarball.
If no version is specified, or if all versions are removed then the
root package entry is removed from the registry entirely.
The package was still there for me after npm unpublish --force.
npm info listed all the versions. npm unpublish package#x.x.x --force removed them individually. After that I checked npmjs.org and the package page said: "This package has been unpublished"

Related

How to safely remove resolve-url?

I have an npm package resolve-url in my React Native project. The package is deprecated, and I'm not using it, so I want to remove it. However, after I run npm uninstall resolve-url to uninstall per npm's documentation, my project no longer runs with npm start!
How do I safely remove resolve-url?
How do I safely remove resolve-url?
It turns out that my project depended on resolve-url through another package, source-map-resolve.
Solution:
npm uninstall source-map-resolve
npm uninstall resolve-url
I deleted the newly created package-lock.json because my project used yarn.lock.
I cleaned up remaining references to source-map-resolve and resolve-url in my yarn.lock.
More info

NPM uninstalled package details still exist in package-lock.json - should I remove them?

npm uninstall react-dates --save
still leaves a lot of traces in package-lock.json - airbnb-prop-types for e.g. How do I remove them? Additionally, if it is the case that it is some other package which uses them, how do I find out which one it is?

NPM still looking for deleted dependency

I deleted some module folders that I had previously npm installed into a module. I also manually removed their entries in my module's package.json. Then, npm would still look for those deleted folders so I re-created the folders and npm uninstalled them, which succeeded. Is there another way to "clear" npm's graph?
Try running npm cache clean --force and then see if the problem still persists. S If would help if you posted your package.json file so that we could see if any problems exist.

How to convert npm-shrinkwrap.json to package-lock.json file?

I have an old project with npm-shrinkwrap.json file.
Now, I want to convert npm-shrinkwrap.json to package-lock.json file.
How can I do that?
The most important thing is the dependency tree and version must be correct.
As a simple solution, we may just rename file from npm-shrinkwrap.json to package-lock.json since both the files are meant to have exactly same content and format. Done! Refs package-lock.json and npm-shrinkwrap.json.
Although both the files have exactly the same content, there are a handful of differences in how npm handles them. For example when we run npm install vs npm ci commands. Also note that package-lock.json will not be published to npm registry unlike npm-shrinkwrap.json, if we ever decide to publish our npm package (using npm publish command). One may refer official npm docs for detailed info on these specific commands.
Cheers!

Package.json pasting a package name in bad?

What happens differently when you go into your package.json and paste a package name in and do npm i vs. doing it the real npm i package-name?
package.json:
"dep": 1.0.0
vs
npm i dep --save
We have a build error and learned can bypass it by pasting. I know it isn't kosher but I really want to know why and what consequences that causes?
npm install dep doesn't add the dependency to the package.json file.
You have to add --save or --save-dev to add it to the package.json file.
Besides that, npm install will always serve you the latest build (in most cases the version tagged as latest (see npm docs)), unless you specify a specific version.
If you want your lock file to update, you have to delete the file before running npm install to generate a lock file with the dependency included (for more info check out this GitHub issue)
In conclussion it shouldn't make much of a difference if you manually add the dependency to package.json file and install it with npm install, unless the latest version of your dependency is broken.