Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install #21

Open
wsfuller opened this issue Jul 7, 2016 · 10 comments
Open

How to install #21

wsfuller opened this issue Jul 7, 2016 · 10 comments

Comments

@wsfuller
Copy link

wsfuller commented Jul 7, 2016

Hey, reading over the documentation on here, NPM, and Node Machine, never really understand how this is supposed to work. Are you supposed to run a sails new projectName and then hook this machinepack in somehow? Or is there and independent command to run and generate a sails app with included Gulp compilation (like `gulpifysails new projectName)? Not really sure how to use this tool and it's never really explained just kind of assumed that the user should know how this is supposed to work.

@Karnith
Copy link
Owner

Karnith commented Jul 7, 2016

Hi wsfuller,

with this machinepack all that is needed is to

  • sails new
  • cd into new project
  • npm install machinepack-prompts machinepack-sailsgulpify
  • npm install
  • node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js

I haven't had a chance to work on hooking into the sails new command yet, since sails uses an rc file for module injection (which is basically a json file).

@wsfuller
Copy link
Author

wsfuller commented Jul 7, 2016

Thanks for the reply. However still a bit confused on how this is supposed to be hooked together.

  • sails new testProject && cd testProject
  • npm install machinepack-prompts machinepack-sailsgulpify --save
  • npm install
  • looked inside node_modules > machine-pack-sailsgulpify > templates > toggleEngine.js

I see in the toggleEngine.js message: "For first time configuration, enter gulpifysails. To switch engines, please enter gulp for gulp engine or grunt for grunt engine.",

That's where I'm stuck. Is there something that needs to be done to the .sailsrc file?

.sailsrc (I've tried configuring this a ton of different ways then run sails lift and never see a prompt to switch task runners

{
  "generators": {
    "modules": {
      "node": "gulpifysails"
    }
  }
}

Is this the correct way but doing something wrong or am I completely missing the point. Was on Sails Concepts but there are no working examples either on how to hook code other than the RC examples which I think I'm doing correctly like any other package.json or bower.json file.

@Karnith
Copy link
Owner

Karnith commented Jul 7, 2016

ok, so after the machinepack is installed, you need to run node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js in the console in the project root directory. When prompted, enter gulpifysails and it will begin to configure sails by adding everything needed for gulp. Once configuration is complete, run node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js again and enter gulp to use gulp or grunt to use grunt. .sailsrc is not used with this machinepack.

@wsfuller
Copy link
Author

wsfuller commented Jul 7, 2016

Thank you for clarifying the installation process. Not sure if further setup is required but this is where I'm at now

  • $ sails new testProject
  • $ cd testProject
  • $ npm install machinepack-prompts machinepack-sailsgulpify --save
  • $ npm install
  • $ node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js
  • At prompt enter gulpifysails then yes
  • ---GulipfySails runs and sets up project to run Gulp (can take a few minutes)---
  • $ node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js (again)
  • At prompt enter gulp
  • $ sails lift

So after doing the above the installation takes place and looks like everything is good to go. However, running sails lift get an error:

error: Gulp :: module.js:327
    throw err;
    ^

Error: Cannot find module     'C:\Users\username\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3

Get the default "server lifted" message but no server is running.

Now running gulp get another error [11:14:53] 'jst:dev' errored after 15 ms | Error: Cannot find module 'gulp-template-compile' from 'C:\Users\username\Desktop\testProject' than receive subsequential errors for the rest of the Gulp Tasks

@Karnith
Copy link
Owner

Karnith commented Jul 7, 2016

ok, you need to npm install -g gulp

@Karnith
Copy link
Owner

Karnith commented Jul 7, 2016

what system areyou using? windows, mac, linux?

@wsfuller
Copy link
Author

wsfuller commented Jul 7, 2016

I have Gulp installed for all my other projects using CLI version 1.2.2 and Local version 3.9.1. Running Windows 10 (not by choice).

@wsfuller
Copy link
Author

wsfuller commented Jul 7, 2016

Ok so doing another global install of Gulp fixed the problem. Not sure why that's the case when I've been using gulp for the past several weeks on this machine.

EDIT

  • npm -g gulp
  • gulp -v
  • Both Local and CLI versions are 3.9.1 instead of stated versions above

@Karnith
Copy link
Owner

Karnith commented Jul 7, 2016

on windows you will need to make sure that after creating the project you delete the node modules folder created by sails. windows doesn't like the linkage that sails creates. So, when you create a new project on windows, delete the node modules folder and do an npm install to get the unlinked modules.

@wsfuller
Copy link
Author

wsfuller commented Jul 7, 2016

So everything seems to be working as expected now. Thanks for all your help really appreciate it. Thought it might be beneficial for newer users, like myself, to have a bit more granular getting started guide. Helps make new tools and such much more approachable for the first time and potentially avoid rudimentary questions for you.

Getting Started

  1. $ sails new testProject
  2. $ cd testProject
  3. $ npm install machinepack-prompts machinepack-sailsgulpify --save
  4. $ npm install
  5. $ node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js
  6. At prompt enter gulpifysails then yes
  7. ---GulipfySails runs and sets up project to run Gulp (can take a few minutes)---
  8. $ node node_modules/machinepack-sailsgulpify/templates/toggleEngine.js (again)
  9. At prompt enter gulp

Mac/Linux

  • $ sails lift

Windows

  • delete ./node_modules created by sails
  • $ npm install
  • $ sails lift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants