Trouble importing OpenZeppelin Contracts into VS Code

My compiler is not recognizing my import. Don't hate me for posting this again. I've clicked through about 10 different forum posts similar to this one but none actually has solved my particular issue after trying.

:computer: Environment

The latest truffle version. I'm using the latest OpenZeppelin code that is downloaded from NPM.

:memo:Details

Long story short I'm new and I've been developing a project that compiles fine before I add an import statement to one of the "@openZeppelin" contracts. I checked the settings and `Solidity: Package Default Dependencies Directory = "node_modules"`

Solidity: Package Default Dependencies Contracts Directory = "" I changed the file structure a few times and I ended up moving node_modules into the same folder as the smart contract I’m importing “@openzeppelin” from and it’s still not working.
Here’s the path I’m using

import "@openzeppelincontracts-upgradeable\tokenERC721ERC721PausableUpgradeable.sol";

I’m not sure what else to do. Yes, it’s installed. I installed it twice just to be sure.

:1234: Code to reproduce

import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol";`

Edit; Typo

1 Like

I think you’re missing a few slashes:

import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol";
//              here ^                      here ^ here ^ 
1 Like

Sorry about that. It must of happened when I was copying the code over.

import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol";

Still gives me the same error

1 Like

I fixed it. for some reason, it needed me to include the root path to the node_modules setting.

Solidity: Package Default Dependencies Directory = "filename/src/node_modules"

1 Like

Hi @presidento23,

Welcome to the community :wave:.

You shouldn’t modify the code in node_modules.

To keep your system secure, you should always use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself.
From: https://docs.openzeppelin.com/contracts/3.x/#usage

See the documentation on how to use and import the upgradeable version of OpenZeppelin Contracts:

What did you want to change in node_modules?

Feel free to share a cut down version of your contract.