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.
@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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.