Tag Archives: Reacts

Error: env [NODE_ENV] is not set (How to Solve)

Error: env [NODE_ENV] is not set

Encountered problem: running project reports error: env [node_env] is not set

Screenshot of the problem:

Solution idea, env in NODE_ENV is not set, resulting in process failure, so you can set the value of this NODE_ENV can be solved. Because it is someone else’s project, I took it over directly, so I searched NODE_ENV globally and found that NODE_ENV=development, so just set NODE_ENV to development.

Implementation method:

1. For Linux:

NODE_ENV=development node foo.js

2. For Windows

SET NODE_ENV=development
node foo.js

Write node foo according to the actual needs of the project JS, some projects can not be written

tips:

It is possible that in addition to the property NODE_ENV is not set, there are other values that are not set, for the same reason, you can set the corresponding value for this value

[Solved] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of me

Build react project prompts error message


<--- Last few GCs --->

[1118:0x104c00000]   210060 ms: Scavenge (reduce) 2020.9 (2049.8) -> 2020.1 (2051.3) MB, 3.4/0.0 ms  (average mu = 0.148, current mu = 0.006) allocation failure 
[1118:0x104c00000]   213180 ms: Mark-sweep (reduce) 2021.0 (2050.3) -> 2020.1 (2051.3) MB, 3117.6/0.0 ms  (average mu = 0.089, current mu = 0.010) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x101319fc5 node::Abort() (.cold.1) [/usr/local/bin/node]
 2: 0x1000b6169 node::Abort() [/usr/local/bin/node]
 3: 0x1000b62df node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 4: 0x100200ba7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0x100200b43 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]

Solution:

1. Install increase-memory-limit.

 npm install -g increase-memory-limit

2. Execute after successful installation

increase-memory-limit

Execute npm run build again and it will be OK!