UPDATE: TDLR
maybe yarn add openzepplin-v5@npm:@openzeppelin/contracts@2.5.1
was not the right thing to do ??
(Still the stupid red lines show up in VScode β¦ )
=========================================================================
During my development I suddenly got the imports underlined in red in VScode, but compiling still worked.
Then I wanted to create a simple crowd sale and tought it might be a good idea to have it in a separate project as it need the v2 contracts while my project is using already v3 contract.
So, to avoid possible confusion I created a new blank truffle project, and npm init, selected even in VScode solc 0.5.16/17 , but now I have the same problem again and on top of that, even compiling on the Linux command line does not work any more.
What could be wrong ???
$ truffle compile
Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js.
Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/TicketCrowdsale.sol
CompileError: /home/sum/DEV/ETH/ZeroSwap/ticket-crowdsale/contracts/TicketCrowdsale.sol:9:1: ParserError: Source "@openzeppelin/contracts/crowdsale/Crowdsale.sol" not found: File import callback not supported
import "@openzeppelin/contracts/crowdsale/Crowdsale.sol";
^-------------------------------------------------------^
,/home/sum/DEV/ETH/ZeroSwap/ticket-crowdsale/contracts/TicketCrowdsale.sol:10:1: ParserError: Source "@openzeppelin/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol" not found: File import callback not supported
import "@openzeppelin/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol";
^------------------------------------------------------------------------------------^
,/home/sum/DEV/ETH/ZeroSwap/ticket-crowdsale/contracts/TicketCrowdsale.sol:11:1: ParserError: Source "@openzeppelin/contracts/crowdsale/validation/TimedCrowdsale.sol" not found: File import callback not supported
import "@openzeppelin/contracts/crowdsale/validation/TimedCrowdsale.sol";
^-----------------------------------------------------------------------^
Compilation failed. See above.
at run (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/run.js:53:1)
at Object.sourcesWithDependencies (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/index.js:121:58)
at necessary (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/index.js:72:1)
at /home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:33:1
at async Promise.all (index 0)
at compile (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:23:1)
at Object.compile (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:66:45)
at Object.run (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/compile.js:86:1)
at Command.run (/home/sum/.nvm/versions/node/v12.19.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)
Truffle v5.1.64 (core: 5.1.64)
Node v12.19.0
[sum@XPS15 ticket-crowdsale]$ truffle version
Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js.
Truffle v5.1.64 (core: 5.1.64)
Solidity v0.5.16 (solc-js)
Node v12.19.0
Web3.js v1.2.9