Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Saturday, January 30, 2016

Sails.js - PATH variable - sails command not recognized

Sails.js - PATH variable - sails command not recognized


After I npm installed Sails.js on Windows Server 2008, "sails" command is not recognized.

Can someone give me a hint on what values to use in the PATH variable? As I understand it is Node.exe that runs the sails.js file. But if I try tunning "node sails.js" command in cmd, it recognizes it, but can't find some of the dependencies.

On my Windows 7 machine everything installed and is running like a charm.

Answer by Arman Bimatov for Sails.js - PATH variable - sails command not recognized


I ended up writing a batch file and putting it into system32 folder "c:\Windows\System32\sails.bat" with this one line:

node C:\Users\XXXXXXXX\AppData\Roaming\npm\node_modules\sails\bin\sails.js  

Now, sails lift works well.

Answer by brzm for Sails.js - PATH variable - sails command not recognized


it looks line a sails.cmd file is create in the global npm folder, so if you add this folder C:\Users\XXXXXX\AppData\Roaming\npm to your PATH sails will be a recognized command, and will accept all valid parameters (tried new and lift and both look OK).

In this way all other node packaged that are command line based should work, if they follow this convention to install on Windows (I think this is the case).

I don't have a Windows Server 2008 to test on but it seems it fails to do this process automatically, as it does on Windows 7

Answer by Saqib for Sails.js - PATH variable - sails command not recognized


Did you try using the -g (for global) option?

If I use:

npm install -g sails  

On either Windows 8.1 or Server 2012R2, I find it is accessible from the path just fine.

Answer by Marcus Rehn for Sails.js - PATH variable - sails command not recognized


If you add a .bat file in system32, remember to add parameters to the bat script. Found that out after trying some of the solutions previously posted here. My example:

C:\Users\Anton\AppData\Roaming\npm\sails %1 %2  

Sails is not a directory there, it's a file. Hope this helps someone.

Answer by venturz909 for Sails.js - PATH variable - sails command not recognized


To help clarify for Windows 8 users. After installing sails globally if receiving errors do this:

  1. Create a sails.txt file

Add this

node C:\Users\XXXXXXX\npm\node_modules\sails\bin\sails.js new node C:\Users\XXXXXXX\npm\node_modules\sails\bin\sails.js lift

  1. Now re-save it as sails.bat

  2. Add this new file to your C:\Windows\System32

Navigate to the folder you want to hold your new sails app. Scaffold the app with the following command:

sails new

If you don't want a front-end, instead type:

sails new --no-frontend

We can also launch the app using the lift command:

sails lift

This will launch our new app on port 1337

Answer by Juan Cerezo for Sails.js - PATH variable - sails command not recognized


you can add new 'node' commands like 'npm', using batch scripting.

  1. Create a sails.cmd file in your desktop. (new text file -> rename to 'sails.cmd').
  2. Right-click on sails.cmd and select Edit.
  3. Copy and paste this code into your sails.cmd:

    @ECHO OFF  SET arguments=%1 %2 %3 %4 %5 %6 %7 %8 %9  node %APPDATA%\npm\node_modules\sails\bin\sails.js %arguments%
  4. Save and copy your sails.cmd into your Node.js installation directory, for example: C:\Program Files\nodejs

  5. And now everything with sails.js on windows are very simple. Just run this command in your terminal:

sails or sails -v or whatever you want with sails! ;)

Enjoy!


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.