Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 852 Vote(s) - 3.43 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'NODE_OPTIONS' is not recognized as an internal or external command

#1
I'm on a windows 10 machine trying to run a build script from the git bash terminal.

On my terminal node is recognized just fine, for example I get the version when I run `node --version`.

But running the build script fails with the following error:

'NODE_OPTIONS' is not recognized as an internal or external command,
operable program or batch file.

I'm guessing I need to add something to my PATH variables to get this to work, but what?
Reply

#2
Use [cross-env][1] 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>",
}
}


[1]:

[To see links please register here]

Reply

#3
For me installing the below mentioned package solved the problem

```
npm install -g win-node-env
```

Reply

#4
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][1].

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"
...
}
...


[1]:

[To see links please register here]

Reply

#5
A way to launch both the node process and the debugger via `F5`, which __does not require wrestling with env vars__.

Make sure `.vscode/launch.json` is deleted.

##### 1. Open the Run & Debug pane
[![ctrl+shift+d][1]][1]

##### 2. Click on Node.js
[![enter image description here][2]][2]

##### 3. DO NOT click on "Run script: dev" directly, instead click on the cog next to it
[![enter image description here][3]][3]

##### 4. Your `launch.json` should look similar to:
```json
{
"configurations": [
{
"type": "node-terminal",
"name": "Run Script: dev",
"request": "launch",
"command": "yarn run dev",
"cwd": "${workspaceFolder}"
}
]
}
```


[1]:

[2]:

[3]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through