You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
$ feathers generate service
? What do you want to call your service? user
? What type of service do you need? database
? For which database? MongoDB
? Does your service require users to be authenticated? Yes
events.js:160
throw er; // Unhandled 'error' event
^
TypeError: /usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/model/templates/mongoose.js:11
9| const Schema = mongoose.Schema;
10|
>> 11| const <%= name %>Schema = new Schema({<% if(name === 'user') { %><% for (var i = 0; i < providers.length; i++) { %>
12| <% if (providers[i] === 'local') { %>email: {type: String, required: true, unique: true},
13| password: { type: String, required: true },
14| <% } else { %><%= providers[i].name %>Id: { type: String },
Cannot read property 'length' of undefined
at eval (eval at <anonymous> (/usr/local/lib/node_modules/feathers-cli/node_modules/ejs/lib/ejs.js:485:12), <anonymous>:19:37)
at returnedFn (/usr/local/lib/node_modules/feathers-cli/node_modules/ejs/lib/ejs.js:514:17)
at Object.exports.render (/usr/local/lib/node_modules/feathers-cli/node_modules/ejs/lib/ejs.js:316:37)
at copy.process (/usr/local/lib/node_mair-4.local auth [master]$
The text was updated successfully, but these errors were encountered:
The user service is kind of special and is generated when creating a new application. The error happens since the generator doesn't know about the selected providers later on.
I'm facing exactly the same issue as described above, so how to generate user service properly ? Did i need to ignore complety the cli tool, why allowing such things if u already know this will generate errors, i'm confused .
You generate the service when generating a new app and it asks if you want to use authentication. Alternatively you can upgrade to the latest version of the CLI (npm install feathers-cli@pre -g) which generates a new structure that does not have the problem.
Here's a copy of my terminal output:
The text was updated successfully, but these errors were encountered: