问题
working with sails beta v0.10-rc8 installed globally. i'm using mac osx 10.9.
sudo npm install sails@beta -g
Then I installed the generator npm package both globally (just to give it a shot) and locally in the folder that will contain the project to be generated like:
~/projects& npm install sails-generate-new-with-mast
created the .sailsrc file in the folder containing the project
~/projects/.sailsrc
and in
~/.sailsrc
the file content is:
{
generators: {
modules: {
new: 'sails-generate-new-with-mast'
}
}
}
when trying to use
~/projects$ sails generate new MyApp
the default generator is used.
What am I doing wrong? tried for a while but couldn't do it.
Thanks in advance!.
TR
回答1:
Generators are a really powerful new feature of Sails v0.10, but the system for utilizing custom ones is still a bit clunky. You were on the right track, but you need to install the generator in your home directory (~/node_modules/sails-generate-new-with-mast) and add a .sailsrc file in your home directory with an absolute path to the generator:
{
generators: {
modules: {
new: '/Users/myusername/node_modules/sails-generate-new-with-mast'
}
}
}
Then sails new
will use that generator.
I must warn you that Mast is completely unsupported and, sadly, pretty much abandoned.
来源:https://stackoverflow.com/questions/24767399/cant-get-the-sails-generate-new-with-mast-generator-to-work-in-sails-0-10