If you develop SPFx web part for Sharepoint and run local web server on dev env:
gulp serve –nobrowser
then you may face with famous “JaavaScript heap out of memory” error:
In order to avoid this error we need to increase nodejs heap size. On Windows it can be done by the following method:
- Run the following command in your terminal client:
setx -m NODE_OPTIONS "--max-old-space-size=8192"
(after that NOTE_OPTIONS should be added to PC > Advanced properties > Environment variables)
- Restart terminal session which is used for running gulp to ensure that new env variables will be applied.
- Run web server:
gulp serve --nobrowser
After that your solution should be built without heap out of memory error.