Run grunt task with node.js arguments on Windows











up vote
3
down vote

favorite












I am running into an out of memory error when running grunt babel. It is solved on mac by increasing max-old-space-size. However some of our developers are on windows machines and I have not found a way to do this on windows.



What is the equilevant of:



node --max-old-space-size=10000 node_modules/.bin/grunt babel


on windows?



Or is there a universal command that works on both?



My dependencies:



"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"grunt-babel": "^8.0.0",
"grunt": "^0.4.5",
"grunt-cli": "^1.3.1",
My babel config in gruntfile.js


My babel config in gruntfile.



babel: {
options: {
compact: true,
presets: ['@babel/preset-env'],
sourceMap: true,
inputSourceMap: sourceMapInJson)
},
},


Error I was getting on Mac and still getting on Windows without increasing max-old-space-size:



FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory


Error I am getting on Windows with max-old-space-size param:



basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list









share|improve this question




















  • 1




    I know that you're asking specifically for windows, I won't be able to help you with that. I just wanted to say, that I had to work on Windows twice (employer requirements) and each time I ended up with setting my own VirtualBox environment with Debian/Ubuntu just for better development experience. If you cannot solve your problem, maybe try running your software in virtualbox or even in a docker where you can use linux as a base, and then pass the --max-old-space-size argument to node. Setting a command that runs docker and runs all tools you need seems to be an overkill but it will work.
    – PolishDeveloper
    Nov 16 at 17:53






  • 1




    Is the command failing on Windows? Does it seem to "work" as in, the command doesn't error out but you still get the error on execution of the task? If latter, just a shot in the dark but have you tried increasing the max on windows? Maybe 10,000 was enough on mac but not Windows...
    – klabranche
    Nov 16 at 17:55










  • Are you sure that the command doesn't work on Windows? because, it's supposed to work. I think the same as @klabranche try setting it to a higher value if it doesn't error out. Also, from the documentation, you can set it as an ENV variable and not have to type it out everytime. - nodejs.org/api/cli.html#cli_node_options_options env NODE_OPTIONS=--max_old_space_size=4096
    – Aravind Voggu
    Nov 16 at 18:00










  • On windows the command gives out this error: basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list
    – Waltari
    Nov 19 at 6:58






  • 1




    Maybe this plugin can helps: npmjs.com/package/increase-memory-limit
    – varit05
    Nov 20 at 11:15















up vote
3
down vote

favorite












I am running into an out of memory error when running grunt babel. It is solved on mac by increasing max-old-space-size. However some of our developers are on windows machines and I have not found a way to do this on windows.



What is the equilevant of:



node --max-old-space-size=10000 node_modules/.bin/grunt babel


on windows?



Or is there a universal command that works on both?



My dependencies:



"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"grunt-babel": "^8.0.0",
"grunt": "^0.4.5",
"grunt-cli": "^1.3.1",
My babel config in gruntfile.js


My babel config in gruntfile.



babel: {
options: {
compact: true,
presets: ['@babel/preset-env'],
sourceMap: true,
inputSourceMap: sourceMapInJson)
},
},


Error I was getting on Mac and still getting on Windows without increasing max-old-space-size:



FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory


Error I am getting on Windows with max-old-space-size param:



basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list









share|improve this question




















  • 1




    I know that you're asking specifically for windows, I won't be able to help you with that. I just wanted to say, that I had to work on Windows twice (employer requirements) and each time I ended up with setting my own VirtualBox environment with Debian/Ubuntu just for better development experience. If you cannot solve your problem, maybe try running your software in virtualbox or even in a docker where you can use linux as a base, and then pass the --max-old-space-size argument to node. Setting a command that runs docker and runs all tools you need seems to be an overkill but it will work.
    – PolishDeveloper
    Nov 16 at 17:53






  • 1




    Is the command failing on Windows? Does it seem to "work" as in, the command doesn't error out but you still get the error on execution of the task? If latter, just a shot in the dark but have you tried increasing the max on windows? Maybe 10,000 was enough on mac but not Windows...
    – klabranche
    Nov 16 at 17:55










  • Are you sure that the command doesn't work on Windows? because, it's supposed to work. I think the same as @klabranche try setting it to a higher value if it doesn't error out. Also, from the documentation, you can set it as an ENV variable and not have to type it out everytime. - nodejs.org/api/cli.html#cli_node_options_options env NODE_OPTIONS=--max_old_space_size=4096
    – Aravind Voggu
    Nov 16 at 18:00










  • On windows the command gives out this error: basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list
    – Waltari
    Nov 19 at 6:58






  • 1




    Maybe this plugin can helps: npmjs.com/package/increase-memory-limit
    – varit05
    Nov 20 at 11:15













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I am running into an out of memory error when running grunt babel. It is solved on mac by increasing max-old-space-size. However some of our developers are on windows machines and I have not found a way to do this on windows.



What is the equilevant of:



node --max-old-space-size=10000 node_modules/.bin/grunt babel


on windows?



Or is there a universal command that works on both?



My dependencies:



"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"grunt-babel": "^8.0.0",
"grunt": "^0.4.5",
"grunt-cli": "^1.3.1",
My babel config in gruntfile.js


My babel config in gruntfile.



babel: {
options: {
compact: true,
presets: ['@babel/preset-env'],
sourceMap: true,
inputSourceMap: sourceMapInJson)
},
},


Error I was getting on Mac and still getting on Windows without increasing max-old-space-size:



FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory


Error I am getting on Windows with max-old-space-size param:



basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list









share|improve this question















I am running into an out of memory error when running grunt babel. It is solved on mac by increasing max-old-space-size. However some of our developers are on windows machines and I have not found a way to do this on windows.



What is the equilevant of:



node --max-old-space-size=10000 node_modules/.bin/grunt babel


on windows?



Or is there a universal command that works on both?



My dependencies:



"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"grunt-babel": "^8.0.0",
"grunt": "^0.4.5",
"grunt-cli": "^1.3.1",
My babel config in gruntfile.js


My babel config in gruntfile.



babel: {
options: {
compact: true,
presets: ['@babel/preset-env'],
sourceMap: true,
inputSourceMap: sourceMapInJson)
},
},


Error I was getting on Mac and still getting on Windows without increasing max-old-space-size:



FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory


Error I am getting on Windows with max-old-space-size param:



basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list






javascript node.js cmd terminal gruntjs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 6:58

























asked Nov 14 at 11:41









Waltari

326728




326728








  • 1




    I know that you're asking specifically for windows, I won't be able to help you with that. I just wanted to say, that I had to work on Windows twice (employer requirements) and each time I ended up with setting my own VirtualBox environment with Debian/Ubuntu just for better development experience. If you cannot solve your problem, maybe try running your software in virtualbox or even in a docker where you can use linux as a base, and then pass the --max-old-space-size argument to node. Setting a command that runs docker and runs all tools you need seems to be an overkill but it will work.
    – PolishDeveloper
    Nov 16 at 17:53






  • 1




    Is the command failing on Windows? Does it seem to "work" as in, the command doesn't error out but you still get the error on execution of the task? If latter, just a shot in the dark but have you tried increasing the max on windows? Maybe 10,000 was enough on mac but not Windows...
    – klabranche
    Nov 16 at 17:55










  • Are you sure that the command doesn't work on Windows? because, it's supposed to work. I think the same as @klabranche try setting it to a higher value if it doesn't error out. Also, from the documentation, you can set it as an ENV variable and not have to type it out everytime. - nodejs.org/api/cli.html#cli_node_options_options env NODE_OPTIONS=--max_old_space_size=4096
    – Aravind Voggu
    Nov 16 at 18:00










  • On windows the command gives out this error: basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list
    – Waltari
    Nov 19 at 6:58






  • 1




    Maybe this plugin can helps: npmjs.com/package/increase-memory-limit
    – varit05
    Nov 20 at 11:15














  • 1




    I know that you're asking specifically for windows, I won't be able to help you with that. I just wanted to say, that I had to work on Windows twice (employer requirements) and each time I ended up with setting my own VirtualBox environment with Debian/Ubuntu just for better development experience. If you cannot solve your problem, maybe try running your software in virtualbox or even in a docker where you can use linux as a base, and then pass the --max-old-space-size argument to node. Setting a command that runs docker and runs all tools you need seems to be an overkill but it will work.
    – PolishDeveloper
    Nov 16 at 17:53






  • 1




    Is the command failing on Windows? Does it seem to "work" as in, the command doesn't error out but you still get the error on execution of the task? If latter, just a shot in the dark but have you tried increasing the max on windows? Maybe 10,000 was enough on mac but not Windows...
    – klabranche
    Nov 16 at 17:55










  • Are you sure that the command doesn't work on Windows? because, it's supposed to work. I think the same as @klabranche try setting it to a higher value if it doesn't error out. Also, from the documentation, you can set it as an ENV variable and not have to type it out everytime. - nodejs.org/api/cli.html#cli_node_options_options env NODE_OPTIONS=--max_old_space_size=4096
    – Aravind Voggu
    Nov 16 at 18:00










  • On windows the command gives out this error: basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list
    – Waltari
    Nov 19 at 6:58






  • 1




    Maybe this plugin can helps: npmjs.com/package/increase-memory-limit
    – varit05
    Nov 20 at 11:15








1




1




I know that you're asking specifically for windows, I won't be able to help you with that. I just wanted to say, that I had to work on Windows twice (employer requirements) and each time I ended up with setting my own VirtualBox environment with Debian/Ubuntu just for better development experience. If you cannot solve your problem, maybe try running your software in virtualbox or even in a docker where you can use linux as a base, and then pass the --max-old-space-size argument to node. Setting a command that runs docker and runs all tools you need seems to be an overkill but it will work.
– PolishDeveloper
Nov 16 at 17:53




I know that you're asking specifically for windows, I won't be able to help you with that. I just wanted to say, that I had to work on Windows twice (employer requirements) and each time I ended up with setting my own VirtualBox environment with Debian/Ubuntu just for better development experience. If you cannot solve your problem, maybe try running your software in virtualbox or even in a docker where you can use linux as a base, and then pass the --max-old-space-size argument to node. Setting a command that runs docker and runs all tools you need seems to be an overkill but it will work.
– PolishDeveloper
Nov 16 at 17:53




1




1




Is the command failing on Windows? Does it seem to "work" as in, the command doesn't error out but you still get the error on execution of the task? If latter, just a shot in the dark but have you tried increasing the max on windows? Maybe 10,000 was enough on mac but not Windows...
– klabranche
Nov 16 at 17:55




Is the command failing on Windows? Does it seem to "work" as in, the command doesn't error out but you still get the error on execution of the task? If latter, just a shot in the dark but have you tried increasing the max on windows? Maybe 10,000 was enough on mac but not Windows...
– klabranche
Nov 16 at 17:55












Are you sure that the command doesn't work on Windows? because, it's supposed to work. I think the same as @klabranche try setting it to a higher value if it doesn't error out. Also, from the documentation, you can set it as an ENV variable and not have to type it out everytime. - nodejs.org/api/cli.html#cli_node_options_options env NODE_OPTIONS=--max_old_space_size=4096
– Aravind Voggu
Nov 16 at 18:00




Are you sure that the command doesn't work on Windows? because, it's supposed to work. I think the same as @klabranche try setting it to a higher value if it doesn't error out. Also, from the documentation, you can set it as an ENV variable and not have to type it out everytime. - nodejs.org/api/cli.html#cli_node_options_options env NODE_OPTIONS=--max_old_space_size=4096
– Aravind Voggu
Nov 16 at 18:00












On windows the command gives out this error: basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list
– Waltari
Nov 19 at 6:58




On windows the command gives out this error: basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list
– Waltari
Nov 19 at 6:58




1




1




Maybe this plugin can helps: npmjs.com/package/increase-memory-limit
– varit05
Nov 20 at 11:15




Maybe this plugin can helps: npmjs.com/package/increase-memory-limit
– varit05
Nov 20 at 11:15












1 Answer
1






active

oldest

votes

















up vote
1
down vote



+50










Npm package increase-memory-limit would help.



this module fix heap out of memory when running node binaries.



As mentioned in its official docs




it will append --max-old-space-size=4096 in all node calls inside your node_modules/.bin/* files.




Hope this helps!






share|improve this answer





















  • Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
    – Waltari
    Dec 3 at 7:17










  • Can you try node --max-old-space-size=8192 {name of the file}?
    – varit05
    Dec 3 at 8:17










  • This doesn't work on windows.
    – Waltari
    2 days ago











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299430%2frun-grunt-task-with-node-js-arguments-on-windows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



+50










Npm package increase-memory-limit would help.



this module fix heap out of memory when running node binaries.



As mentioned in its official docs




it will append --max-old-space-size=4096 in all node calls inside your node_modules/.bin/* files.




Hope this helps!






share|improve this answer





















  • Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
    – Waltari
    Dec 3 at 7:17










  • Can you try node --max-old-space-size=8192 {name of the file}?
    – varit05
    Dec 3 at 8:17










  • This doesn't work on windows.
    – Waltari
    2 days ago















up vote
1
down vote



+50










Npm package increase-memory-limit would help.



this module fix heap out of memory when running node binaries.



As mentioned in its official docs




it will append --max-old-space-size=4096 in all node calls inside your node_modules/.bin/* files.




Hope this helps!






share|improve this answer





















  • Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
    – Waltari
    Dec 3 at 7:17










  • Can you try node --max-old-space-size=8192 {name of the file}?
    – varit05
    Dec 3 at 8:17










  • This doesn't work on windows.
    – Waltari
    2 days ago













up vote
1
down vote



+50







up vote
1
down vote



+50




+50




Npm package increase-memory-limit would help.



this module fix heap out of memory when running node binaries.



As mentioned in its official docs




it will append --max-old-space-size=4096 in all node calls inside your node_modules/.bin/* files.




Hope this helps!






share|improve this answer












Npm package increase-memory-limit would help.



this module fix heap out of memory when running node binaries.



As mentioned in its official docs




it will append --max-old-space-size=4096 in all node calls inside your node_modules/.bin/* files.




Hope this helps!







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 at 12:45









varit05

1,630715




1,630715












  • Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
    – Waltari
    Dec 3 at 7:17










  • Can you try node --max-old-space-size=8192 {name of the file}?
    – varit05
    Dec 3 at 8:17










  • This doesn't work on windows.
    – Waltari
    2 days ago


















  • Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
    – Waltari
    Dec 3 at 7:17










  • Can you try node --max-old-space-size=8192 {name of the file}?
    – varit05
    Dec 3 at 8:17










  • This doesn't work on windows.
    – Waltari
    2 days ago
















Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
– Waltari
Dec 3 at 7:17




Actually this doens't fix it on Windows. There was a communication mismatch with my collegue.
– Waltari
Dec 3 at 7:17












Can you try node --max-old-space-size=8192 {name of the file}?
– varit05
Dec 3 at 8:17




Can you try node --max-old-space-size=8192 {name of the file}?
– varit05
Dec 3 at 8:17












This doesn't work on windows.
– Waltari
2 days ago




This doesn't work on windows.
– Waltari
2 days ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299430%2frun-grunt-task-with-node-js-arguments-on-windows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents