I am trying to install ERC20 smart contracts v3.3.0 from OpenZeppelin inside my project. The feedback from the terminal looks ok but I cannot see the OpenZeppelin node modules folder that should appear in my truffle project.
Truffle v5.1.56 (core: 5.1.56)
Solidity v0.5.16 (solc-js)
Node v12.19.0
Web3.js v1.2.9
Details
Installing using the terminal but node modules folder missing after installation
Code to reproduce
PS C:\Users\Asusupernova\Documents\ETH\React1 - Copy> npm install @openzeppelin/contracts@v3.3.0
npm WARN saveError ENOENT: no such file or directory, open ‘C:\Users\Asusupernova\package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘C:\Users\Asusupernova\package.json’
npm WARN Asusupernova No description
npm WARN Asusupernova No repository field.
npm WARN Asusupernova No README data
npm WARN Asusupernova No license field.
+ @openzeppelin/contracts@3.3.0
updated 1 package and audited 41 packages in 2.044s
2 packages are looking for funding
run `npm fund` for details
1 Like
Hi @Altaergo,
Welcome to the community
The first two warnings are that you don’t have a package.json
file.
To initialize a project we can run npm init -y
in our project directory (see: https://docs.openzeppelin.com/learn/setting-up-a-node-project#creating-a-project)
There isn’t a tag v3.3.0
for OpenZeppelin Contracts so I assume npm installs the latest version.
You can use either npm install @openzeppelin/contracts
or npm install @openzeppelin/contracts@3.3.0
I tried reproducing on Windows and I get warnings if I don’t have a package.json
file but a node_modules
directory containing @openzeppelin
and contracts
is created.
Can you try doing this again with the project initialized (npm init -y
).
1 Like
Thanks for welcoming me here, I am excited to learn Solidity.
I am getting mixed up by the order of operations.
Eventually, I want to use Truffle unbox react
. And after running npm init -y
in an empty directory, I get the basic truffle structure without the added components of Truffle unbox react
.Do I override?
Also, just wondering why the package.json
inside the client folder of unbox react
isn’t recognized
1 Like
Hi @Altaergo,
As for the order, try the following in an empty directory:
npm init -y
npm install truffle
npm install @openzeppelin/contracts
npx truffle unbox react
For learning Solidity, I recommend going through: Solidity learning resources.
1 Like
Hi @Altaergo,
To specify the Solidity compiler version to use, you set that in your truffle-config.js