'NODE_OPTIONS' is not recognized as an internal or external command
Use cross-env package which easily sets environment variables.
Step 1:
Install cross-env from npm
npm i cross-env
In your package.json file (In this example your need is to run 'start' command which has 'NODE_OPTIONS')
{ "name": "your-app", "version": "0.0.0", "scripts": { ... "start": "NODE_OPTIONS=<your options> <commands>", }}
Step 2
Add 'cross-env' in the script which you need to run NODE_OPTIONS. (In this case 'start' script)
{ "name": "your-app", "version": "0.0.0", "scripts": { ... "start": "cross-env NODE_OPTIONS=<your options> <commands>", }}
For me installing the below mentioned package solved the problem
npm install -g win-node-env
Not a PATH issue, NODE_OPTIONS is an ENVIRONMENT VARIABLE that needs to be set before starting your build. To set en environment variable in Windows 10 you need to use the set
command in a terminal mode. See this article on SUPERUSER forum to learn more.
In your case, just add set
before NODE_OPTIONS
and that will fix your issue.
Here's how to integrate it in package.json:
..."scripts": { ... "build": "set NODE_OPTIONS=--max_old_space_size=4096 && next build" ...}...