Tag Archives: Front end react

Error in react build packaging test environment

#NPM run build: test or yarn build: Test

        

Dotenv cli needs to be installed before use( https://github.com/entropitor/dotenv-cli )Otherwise, the following error will be reported:

dotenv -e .env.development craco build

'dotenv' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:test: `dotenv -e .env.development craco build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\node\node_cache\_logs\2021-09-01T02_25_42_552Z-debug.log

 

To install global dotenv cli:

Execute command:   yarn global add dotenv-cli           perhaps         npm   install -g   dotenv-cli  

Installation complete:

Execute again as shown in the figure:

Packaging complete