Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Execute NODE JS command

    Scheduled Pinned Locked Moved Support
    buildmaster
    7 Posts 1 Posters 167 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      Hi,

      I am trying to execute a NODE JS command from buildmaster.

      I tried the following without success:

      • Execute a command line, with a bat file
      • Execute a powershell script
      • Execute a powershell file

      If I execute these commands above, in the server, it works properly. Even for a user without administrative rights.

      I am trying to execute the grunt module, so I am installing the module and run the module. Any idea how to solve this problem?

      The commands I am trying to execute are:

      • npm install grunt-cli -g
      • grunt less

      Thanks,

      Andy

      Product: BuildMaster
      Version: 4.3.7

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        Hi Andy, what specific error message are you getting? Those commands should work, assuming npm and grunt are in the path.

        When using execute command line, note that you have to specify arguments on the arguments field, not in the executable name field.

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          Hi Alana,

          Thank you for your response.

          When executing a command line I did not receive any error message.
          When executing as powershell script I got the following messages:

          Command: npm install -g grunt-cli
          Message: The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try agai

          Command: grunt less
          Message: The term 'grunt' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

          I could execute the first command (npm install -g grunt-cli) from command line. After your message, I set up the command lines as following and it worked perfectly:

          • Executable file: C:\Program Files\nodejs\npm.cmd
          • Arguments: install grunt-cli -g

          After executing the command above, it shows the following:

          C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\grunt -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt

          grunt-cli@0.1.13 C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\grunt-cliâ -
          nopt@1.0.10 (abbrev@1.0.5)- resolve@0.3.1 - findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.1)

          Now I am facing some issues trying to execute the grunt less command. How can I execute the grunt command?

          Thanks in advance

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            Any help with this?

            Regards

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              Powershell is probably going to be the eaiest way to go, especially as you write more powershell scripts that use Nodejs.

              If you're getting the "npm not found" error during powershell, it sounds like NPM is not on the path. I would do a search for that specific NP not found error message. Heres' what I found, which may or may not be of help?

              http://stackoverflow.com/questions/20992723/npm-is-not-recognized-as-internal-or-external-command-operable-program-or-bat

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                Thanks Alana for your post. That helped me to solve the problem.

                When we install node's modules, it stores the modules into user's appdata folder (eg.: c:\users\joe\appData\Roamind) and add this path into %path% variable.

                Running the command from BuildMaster, it will run as system user, saving the modules into C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\ folder and adds the this path into %path% variable.

                It seems that Windows 64bits has some problems "refreshing" these values for all users/services/process and even if you check the variable, it will display your change, but running process will not get the updated value.

                The solution: Restart the computer. Some people say that is not necessary to restart the computer other people say it is. In my case, restart the computer worked for me.

                After restarted the computer, I could see the path created by grunt install command and I could use the grunt less command with both powershell and bat files.

                Once again, thank you very much Alana.

                Andy

                1 Reply Last reply Reply Quote 0
                • ? This user is from outside of this forum
                  Guest
                  last edited by

                  Thanks Andy ..server restart did the trick...cheers!!

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post
                  Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation