My configuration have MongoDB as the database. When running the command NODE_ENV=production npm run build, I am returned with an error which says The term ‘NODE_ENV=production’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Am I missing to setup anything on my machine?
[details=“System Information”]
-
Strapi Version: 3.5.4
-
Operating System: Windows 10
-
Database: MongoDB
-
Node Version: 14.16.1
-
NPM Version: 6.14.4
Just tried to set NODE_ENV=production and it still builds with development environment as you can see in the image attached.

Tried these 2 commands too, and got no luck.
FYI, I’m using VS Code for development and building the application.

Thanks.
You can try with the cross-env option, sorry I don’t use Windows on a regular basis.
The best solution would probably be to add a package.json script like:
"build:prod": "cross-env NODE_ENV=production yarn build --clean",
npm install cross-env
Add the following in package.json
scripts section:
"production": "cross-env NODE_ENV=production npm run build"
Run the command
npm run production
1 Like
We should already have cross-env installed within Strapi itself so no need to install it directly