The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
Installing npm packages as standalone apps
How can one install an npm package as a standalone app and not as an app dependency in
I do not want to download the source files but the “built” npm package.
I know I can take the package from the automatically created
node_modules folder but is there a less tedious way to do this?
I am new here, and any help would be much appreciated
You might be looking for the
--global option, like:
npm install --global n
@shadowspawn But then how do you tell npm that the package should be installed in the directory where the command is executed?
I am not sure what behaviour you are looking for. When you install package “foo” as a dependency, you get the production install of “foo”. What shortcut are you looking for?
So I would to do something like
npm install foo --standalone
This would download the package
foo, create a directory
foo in the pwd and place its files there.
Is this possible?
There’s no npm command to do this, but it’s not hard to do.
mkdir foo cd foo npm view foo dist.tarball | xargs curl -s | tar x --strip=1 npm install
It works great, I just had to download the tarball before with
npm pack because it is a private package.