Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Can't generate a new service (Node 6.2.0 on Mac OS X 10.11.5) #28

Closed
hutchike opened this issue Jun 11, 2016 · 4 comments
Closed

Can't generate a new service (Node 6.2.0 on Mac OS X 10.11.5) #28

hutchike opened this issue Jun 11, 2016 · 4 comments

Comments

@hutchike
Copy link

Here's a copy of my terminal output:

$ 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]$
@daffl
Copy link
Member

daffl commented Jun 12, 2016

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.

@daffl daffl closed this as completed Sep 2, 2016
@letminin
Copy link

letminin commented Mar 13, 2017

Hi,

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 .

@daffl
Copy link
Member

daffl commented Mar 13, 2017

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.

@letminin
Copy link

Upgraded to the latest version of the CLI fix the problem, great, thanx for your reactivity :)

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

No branches or pull requests

3 participants