Here is what i've done in a blank directory:

$ truffle unbox react
$ npm install @openzeppelin/contracts
$ npm install @openzeppelin/test-helpers
$ npm install @truffle/hdwallet-provider

Then, i have create a .gitignore (in root directory):


I have run:

$ git add .
$ git commit -m "message"

And i have pushed this local git to a github repository

I have cloned the github repository on a second computer.

I need to run this commands again to make runnable my project on the second computer:

$ npm install @openzeppelin/contracts
$ npm install @openzeppelin/test-helpers
$ npm install @truffle/hdwallet-provider

My question is how can i avoid to run this commands ? I have tried to run "npm install" but it does not work. I have no package.json at the root of my project.

Have i made something wrong ?



Sounds like you need this:

Truffle box - React

Assuming that you have done the following steps:

  • mkdir myproject
  • cd myproject
  • npx truffle unbox react

After this step you want to create a node project, so you can save your dependencies.

  • npm init: Keep hitting enter for default values
  • npm install @openzeppelin/contracts
  • npm install @openzeppelin/test-helpers
  • npm install @truffle/hdwallet-provider

Now, you can create your .gitignore file, and put node_modules there.

I hope this helps.

  • I have read this tutorial too but it does not answer to my git clone problem. What i want to know is what i should do after git clone to automaticaly install dependencies
    – Bob5421
    Apr 5 at 11:00
  • I misunderstood what you were asking. Check the updated answer. Apr 5 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.