angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.12k stars 1.24k forks source link

socketio undefined generating new endpoint #851

Closed jordanbaucke closed 9 years ago

jordanbaucke commented 9 years ago

I started getting this error when attempting to generate a new endpoint: yo angular-fullstack:endpoint ...

Jordans-MacBook-Pro:fixed jordanbaucke$ yo angular-fullstack:endpoint company
? What will the url of your endpoint to be? /api/companies

/Users/jordanbaucke/.nvm/v0.10.33/lib/node_modules/generator-angular-fullstack/endpoint/index.js:58
  if (this.filters.socketio) {
                  ^
TypeError: Cannot read property 'socketio' of undefined
    at Generator.registerEndpoint (/Users/jordanbaucke/.nvm/v0.10.33/lib/node_modules/generator-angular-fullstack/endpoint/index.js:58:19)
    at /Users/jordanbaucke/.nvm/v0.10.33/lib/node_modules/generator-angular-fullstack/node_modules/yeoman-generator/lib/base.js:395:14
    at processImmediate [as _immediateCallback] (timers.js:345:15)

The generator runs fine otherwise (ie the same call against a different app) - I've purged my node_nodes directory and reinstalled...with no success.

kingcody commented 9 years ago

@jordanbaucke, whats the output from:

cat /Users/jordanbaucke/.nvm/v0.10.33/lib/node_modules/generator-angular-fullstack/package.json

and

cat YOUR_PROJECT_FOLDER/.yo-rc.json
jordanbaucke commented 9 years ago
Jordans-MBP:datadrain-fixed jordanbaucke$ cat /Users/jordanbaucke/.nvm/v0.10.33/lib/node_modules/generator-angular-fullstack/package.json
{
  "name": "generator-angular-fullstack",
  "version": "2.0.13",
  "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node",
  "keywords": [
    "yeoman-generator",
    "mean",
    "mongodb",
    "angularjs",
    "express",
    "scaffold",
    "fullstack",
    "framework",
    "component",
    "front-end",
    "app"
  ],
  "homepage": "https://github.com/DaftMonk/generator-angular-fullstack",
  "bugs": {
    "url": "https://github.com/DaftMonk/generator-angular-fullstack/issues"
  },
  "author": {
    "name": "Tyler Henkel"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/DaftMonk/generator-angular-fullstack.git"
  },
  "scripts": {
    "test": "grunt test"
  },
  "dependencies": {
    "yeoman-generator": "~0.17.0",
    "chalk": "~0.4.0",
    "wiredep": "~0.4.2",
    "generator-ng-component": "~0.0.4"
  },
  "peerDependencies": {
    "yo": ">=1.2.0"
  },
  "devDependencies": {
    "chai": "^1.9.1",
    "fs-extra": "^0.9.1",
    "grunt": "~0.4.1",
    "grunt-build-control": "git://github.com/DaftMonk/grunt-build-control",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-jshint": "^0.10.0",
    "grunt-conventional-changelog": "~1.0.0",
    "grunt-mocha-test": "^0.11.0",
    "grunt-release": "~0.6.0",
    "load-grunt-tasks": "~0.2.0",
    "marked": "~0.2.8",
    "mocha": "~1.21.0",
    "q": "^1.0.1",
    "semver": "~2.2.1",
    "shelljs": "^0.3.0",
    "underscore.string": "^2.3.3"
  },
  "engines": {
    "node": ">=0.10.0",
    "npm": ">=1.2.10"
  },
  "licenses": [
    {
      "type": "BSD"
    }
  ],
  "_id": "generator-angular-fullstack@2.0.13",
  "_shasum": "866333e9ca1e557336342b57b585582f65dd61bb",
  "_from": "generator-angular-fullstack@",
  "_npmVersion": "1.4.10",
  "_npmUser": {
    "name": "daftmonk",
    "email": "tylerhenkel@hotmail.com"
  },
  "maintainers": [
    {
      "name": "daftmonk",
      "email": "tylerhenkel@hotmail.com"
    }
  ],
  "dist": {
    "shasum": "866333e9ca1e557336342b57b585582f65dd61bb",
    "tarball": "http://registry.npmjs.org/generator-angular-fullstack/-/generator-angular-fullstack-2.0.13.tgz"
  },
  "directories": {},
  "_resolved": "https://registry.npmjs.org/generator-angular-fullstack/-/generator-angular-fullstack-2.0.13.tgz",
  "readme": "ERROR: No README data found!"
}

and hmmm, I don't have a .yo-rc.json well that could be it! let me see if that fixes it.

jordanbaucke commented 9 years ago

Yep! That was it ...! I kept doing a diff-compare on the directories but .yo-rc.json didn't show because it didn't exist...!

kingcody commented 9 years ago

Haha, awesome. Glad to see you got it worked out.

olefrank commented 9 years ago

I had the same issue. And I DO have .yo-rc.json.

I changed this:(from true to false) "insertSockets": false,

And removed these: "registerSocketsFile": "server/config/socketio.js", "socketsNeedle": "// Insert sockets below",

This works for me