'File import callback not supported on truffle migrate
I have a truffle project with the following contract (elided) that I'm running with truffle migrate:
1 pragma solidity >=0.6.0;
2
3 // implements the ERC721 standard
4 import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5 // keeps track of the number of tokens issued
6 import "@openzeppelin/contracts/utils/Counters.sol";
7 import "@openzeppelin/contracts/access/Ownable.sol";
But I'm getting the following error:
> Compiling ./contracts/NFT.sol
> Compilation warnings encountered:
Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> project:/contracts/Creation.sol
ParserError: Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File import callback not supported
--> project:/contracts/NFT.sol:6:1:
|
6 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
,ParserError: Source "@openzeppelin/contracts/utils/Counters.sol" not found: File import callback not supported
--> project:/contracts/NFT.sol:8:1:
|
8 | import "@openzeppelin/contracts/utils/Counters.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
,ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
--> project:/contracts/NFT.sol:9:1:
|
9 | import "@openzeppelin/contracts/access/Ownable.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed. See above.
Truffle v5.4.0 (core: 5.4.0)
Node v14.15.5
How to fix this error?
Solution 1:[1]
Even though my contract works I had the same error... I just changed:
import "@openzeppelin/contracts/utils/Counters.sol";
To a more explicit form:
import "../node_modules/@openzeppelin/contracts/utils/Counters.sol";
and bypass those red squiggles.
Solution 2:[2]
Have you run the following commands
$ npm init
$ npm i -s @openzeppelin/contracts
Solution 3:[3]
I saw a lot of videos the result of all of them is: the two modules are automatically connected to each other when power is on. but mine is not!
This confuses me, I can't see any command that will let you initiate connection. My guess is that AT+BIND is a command for trusting. However AT+CMODE is explained as:
Param1: Connection mode: 0 -> Connect the module to the specified Bluetooth address. (Bluetooth address can be specified by the binding command)
In this case, I would send AT+BIND first rather than setting CMODE.
If we have a look at HC-05 AT command list, we can see that there are other commands that are used to establish classical Bluetooth connection. I would do the following in order:
AT+PAIR=MACAT+BIND=MACAT+LINK=MAC
I would also check the status via AT+STATE?.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Antoine |
| Solution 2 | Kundan |
| Solution 3 | Mr. Panda |
