Open mjsorribas opened 8 years ago
I had the same problem. Any advice?
I resolve this error TypeError: _.pluck is not a function by this:
1 - path_to_my_server/sailsTest/node_modules/sails-generate-scaffold/
npm install underscore
2 - add in the top of Generator.js
_.pluck = require('underscore');
but then comes another in this lines:
compiledNewFlash = compiledNewFlash.replace(/ERBstart/g, '<%') compiledNewFlash = compiledNewFlash.replace(/ERBend/g, '%>')
it said that replace is not a function.
I also resolve that by change in all coincidences:
compiledNewFlash = compiledNewFlash.replace(new RegExp(/ERBstart/g, 'g'), '<%');
Solution:
npm install underscore
Insert following code in node_modules/sails-generate-scaffold/Generator.js line 12:
_.pluck = require('underscore');
my_template = _.template;
_.template = function(arg1, arg2) {
return my_template(arg1)(arg2);
}
or
npm install -S "git+https://github.com/marlonscalabrin/sails-generate-scaffold.git"
Solution: Change this line var modelAttributeNames = .pluck(scope.modelAttributes, 'name'); by this line var modelAttributeNames = .map(scope.modelAttributes, 'name');
yes facing the same problem as well but @marlonscalabrin solution fixed the problem. thx bro!
nearly 3 years and this problem is still not fixed, sails is dead.
nearly 3 years and this problem is still not fixed, sails is dead.
@moda20 this is a community project, it is not part of the core SailsJS project which is very active: https://github.com/balderdashy/sails/
I found a fork of this project here: https://github.com/e9labs/sails-generate-scaffold which solves the problem.
When i tried $ sails generate scaffold services //for example.. i obtain this error: nodemodules/sails-generate-scaffold/Generator.js:102 var modelAttributeNames = .pluck(scope.modelAttributes, 'name'); TypeError: _.pluck is not a function at Object.module.exports.before (/.../node_modules/sails-generate-scaffold/Generator.js:102:33) at generate (/usr/lib/node_modules/sails/node_modules/sails-generate/lib/generate.js:73:13) at module.exports (/usr/lib/node_modules/sails/node_modules/sails-generate/lib/index.js:112:3) at Command.module.exports (/usr/lib/node_modules/sails/bin/sails-generate.js:107:10) at Command.listener (/usr/lib/node_modules/sails/node_modules/commander/index.js:301:8) at emitTwo (events.js:87:13) at Command.emit (events.js:172:7) at Command.parseArgs (/usr/lib/node_modules/sails/node_modules/commander/index.js:615:12) at Command.parse (/usr/lib/node_modules/sails/node_modules/commander/index.js:458:21) at Object. (/usr/lib/node_modules/sails/bin/sails.js:145:9)