I have a nodejs project on GitHub. I use git clone ${GitHubUrl}
to clone it for development. I use npm install ${GitHubUrl}
or npm update
for production use.
git clone
sets up a git repo for development/committing, however it does not install package dependencies.
npm install
installs package dependencies, however it does not set up a git repo for developing or committing.
Is there a command that combines these two? Surely this is a fairly common workflow and someone has a better solution for this. Perhaps something like git clone ${GitHubUrl}
then some npm command?
A workable solution here could be commit ./node_modules
into the git repo, but that has obvious disadvantages.
npm install git doesn't install git (i.e. the command line tool to manipulate git repositories). It installs the npm package called git which seems to be a JavaScript library to interact with git repositories (which makes the name accurate, but still misleading). npm is not a general-purpose package manager.
git clone sets up a git repo for development/committing, however it does not install package dependencies.
@SLaks has the right answer.
git clone foo && cd foo && npm i
I did not realize npm install
with no additional arguments installs the local package.json
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With