NodeJS script works fine on macOS but not on Windows












0















I am trying to run a Node project that was created by someone using a Mac, but when I run npm run start it errors out with the message:



npm ERR! missing script: clean;



The error occurs in both CMD and Powershell.



I would guess that this is a syntax issue because in our package.json there is a script with the code "npm run clean; npm run build"; I assume that on Mac it treats the semicolon as a separator between two commands, while on Windows it seems to treat the semicolon as part of the word "clean" and attempts to run the script "clean;", which doesn't exist.



Is there a way to get this script to run on my computer without changing the project? If not, is there a way to change the project so that the same script will work on both Mac and Windows?



Thanks.










share|improve this question



























    0















    I am trying to run a Node project that was created by someone using a Mac, but when I run npm run start it errors out with the message:



    npm ERR! missing script: clean;



    The error occurs in both CMD and Powershell.



    I would guess that this is a syntax issue because in our package.json there is a script with the code "npm run clean; npm run build"; I assume that on Mac it treats the semicolon as a separator between two commands, while on Windows it seems to treat the semicolon as part of the word "clean" and attempts to run the script "clean;", which doesn't exist.



    Is there a way to get this script to run on my computer without changing the project? If not, is there a way to change the project so that the same script will work on both Mac and Windows?



    Thanks.










    share|improve this question

























      0












      0








      0








      I am trying to run a Node project that was created by someone using a Mac, but when I run npm run start it errors out with the message:



      npm ERR! missing script: clean;



      The error occurs in both CMD and Powershell.



      I would guess that this is a syntax issue because in our package.json there is a script with the code "npm run clean; npm run build"; I assume that on Mac it treats the semicolon as a separator between two commands, while on Windows it seems to treat the semicolon as part of the word "clean" and attempts to run the script "clean;", which doesn't exist.



      Is there a way to get this script to run on my computer without changing the project? If not, is there a way to change the project so that the same script will work on both Mac and Windows?



      Thanks.










      share|improve this question














      I am trying to run a Node project that was created by someone using a Mac, but when I run npm run start it errors out with the message:



      npm ERR! missing script: clean;



      The error occurs in both CMD and Powershell.



      I would guess that this is a syntax issue because in our package.json there is a script with the code "npm run clean; npm run build"; I assume that on Mac it treats the semicolon as a separator between two commands, while on Windows it seems to treat the semicolon as part of the word "clean" and attempts to run the script "clean;", which doesn't exist.



      Is there a way to get this script to run on my computer without changing the project? If not, is there a way to change the project so that the same script will work on both Mac and Windows?



      Thanks.







      node.js macos powershell cmd






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 5:11









      Aaron TAaron T

      344213




      344213
























          1 Answer
          1






          active

          oldest

          votes


















          0














          To run build after clean use && to run the commands sequentially.



          npm run clean && npm run build






          share|improve this answer
























          • I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

            – gvee
            Jan 2 at 7:42













          • && works in PowerShell.

            – Rajika Imal
            Jan 2 at 8:13













          • Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

            – gvee
            Jan 2 at 11:52













          • Works in 5.1, build 17134

            – Rajika Imal
            Jan 2 at 11:55











          • && works great in CMD, PowerShell, and the mac terminal.

            – Aaron T
            Jan 10 at 1:50











          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',
          autoActivateHeartbeat: false,
          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%2f54001491%2fnodejs-script-works-fine-on-macos-but-not-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









          0














          To run build after clean use && to run the commands sequentially.



          npm run clean && npm run build






          share|improve this answer
























          • I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

            – gvee
            Jan 2 at 7:42













          • && works in PowerShell.

            – Rajika Imal
            Jan 2 at 8:13













          • Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

            – gvee
            Jan 2 at 11:52













          • Works in 5.1, build 17134

            – Rajika Imal
            Jan 2 at 11:55











          • && works great in CMD, PowerShell, and the mac terminal.

            – Aaron T
            Jan 10 at 1:50
















          0














          To run build after clean use && to run the commands sequentially.



          npm run clean && npm run build






          share|improve this answer
























          • I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

            – gvee
            Jan 2 at 7:42













          • && works in PowerShell.

            – Rajika Imal
            Jan 2 at 8:13













          • Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

            – gvee
            Jan 2 at 11:52













          • Works in 5.1, build 17134

            – Rajika Imal
            Jan 2 at 11:55











          • && works great in CMD, PowerShell, and the mac terminal.

            – Aaron T
            Jan 10 at 1:50














          0












          0








          0







          To run build after clean use && to run the commands sequentially.



          npm run clean && npm run build






          share|improve this answer













          To run build after clean use && to run the commands sequentially.



          npm run clean && npm run build







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 7:02









          Rajika ImalRajika Imal

          163312




          163312













          • I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

            – gvee
            Jan 2 at 7:42













          • && works in PowerShell.

            – Rajika Imal
            Jan 2 at 8:13













          • Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

            – gvee
            Jan 2 at 11:52













          • Works in 5.1, build 17134

            – Rajika Imal
            Jan 2 at 11:55











          • && works great in CMD, PowerShell, and the mac terminal.

            – Aaron T
            Jan 10 at 1:50



















          • I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

            – gvee
            Jan 2 at 7:42













          • && works in PowerShell.

            – Rajika Imal
            Jan 2 at 8:13













          • Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

            – gvee
            Jan 2 at 11:52













          • Works in 5.1, build 17134

            – Rajika Imal
            Jan 2 at 11:55











          • && works great in CMD, PowerShell, and the mac terminal.

            – Aaron T
            Jan 10 at 1:50

















          I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

          – gvee
          Jan 2 at 7:42







          I don't think && works in PowerShell. Try a semi-colon ; or pipe instead |

          – gvee
          Jan 2 at 7:42















          && works in PowerShell.

          – Rajika Imal
          Jan 2 at 8:13







          && works in PowerShell.

          – Rajika Imal
          Jan 2 at 8:13















          Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

          – gvee
          Jan 2 at 11:52







          Not in PowerShell 5.1 or earlier. Unable to confirm for later versions

          – gvee
          Jan 2 at 11:52















          Works in 5.1, build 17134

          – Rajika Imal
          Jan 2 at 11:55





          Works in 5.1, build 17134

          – Rajika Imal
          Jan 2 at 11:55













          && works great in CMD, PowerShell, and the mac terminal.

          – Aaron T
          Jan 10 at 1:50





          && works great in CMD, PowerShell, and the mac terminal.

          – Aaron T
          Jan 10 at 1:50




















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001491%2fnodejs-script-works-fine-on-macos-but-not-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

          MongoDB - Not Authorized To Execute Command

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

          Npm cannot find a required file even through it is in the searched directory