''export' in VS code show problem statement "Declaration or statement expected." and cannot find name 'WEB3_INFURA_PROJECT_ID' and 'PRIVATE_KEY'

I am trying to create a ERC20 standard token using VS code by following a Youtube video https://www.youtube.com/watch?v=8rpir_ZSK1g . Until I reached the .env file, there was a problem showed which is this:My brownie-config.yaml file:

Can someone tell me what that I missed or why will this problem will occur?

I am new learner of blockchain application. I think there is something I missed to install.



Solution 1:[1]

Declarations of environment variables in .env file should follow key-value manner, like:

PRIVATE_KEY='some-private-key-hex'

Using export command is useful when you want to source this file outside of brownie. If your .env file looks like:

export PRIVATE_KEY='some-private-key-hex'

then source it, like

source .env

However the recommended way of setting envs is the first one.

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