Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Install with Git Clone

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.

like image 352
GreenFox Avatar asked Aug 23 '17 17:08

GreenFox


People also ask

Can you install git with npm?

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.

Does git clone install dependencies?

git clone sets up a git repo for development/committing, however it does not install package dependencies.


1 Answers

@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.

like image 124
GreenFox Avatar answered Oct 14 '22 14:10

GreenFox