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

Error: Cannot find module 'feathers-errors/handler' #78

Closed
thejones opened this issue Mar 18, 2016 · 11 comments
Closed

Error: Cannot find module 'feathers-errors/handler' #78

thejones opened this issue Mar 18, 2016 · 11 comments

Comments

@thejones
Copy link
Contributor

Generator using postgres, github, and facebook auth. As far as I can tell it installed feathers-errors but maybe only within Sequelize? Running npm install --save feathers-errors fixes the error as expected. Unsure where this actually needs to get pulled in from.

npm stuff...
└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected]

[email protected] node_modules/feathers-errors -> node_modules/feathers-sequelize/node_modules/feathers-errors
[email protected] /Users/ajones/git/training/feathers/feathers-chat
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └── [email protected]


Woot! We've created your "feathers-chat" app!
Make sure that your postgres database is running...
To start your feathers server run `npm start`.
513 ajones:feathers-chat$npm start

> [email protected] start /Users/ajones/git/training/feathers/feathers-chat
> node src/

module.js:328
    throw err;
    ^

Error: Cannot find module 'feathers-errors/handler'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/ajones/git/training/feathers/feathers-chat/src/middleware/index.js:3:17)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)

So:

514 ajones:feathers-chat$npm install --save feathers-errors
[email protected] /Users/ajones/git/training/feathers/feathers-chat
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └── [email protected]

515 ajones:feathers-chat$npm start

All good.

@ekryski
Copy link
Member

ekryski commented Mar 18, 2016

Let's keep this open. There is something weird going on here. I've run into this before and so have other people but it only happens randomly. Re-installing definitely fixes it but I'm not sure if it is an npm issue or yeoman, or a problem with how we defined dependencies...

Either way I WANT IT FIXED! It's such a shitty first experience. Thanks for giving such a detailed report @thejones!

@daffl
Copy link
Member

daffl commented Mar 19, 2016

One more question @thejones: Do you remember if the dependency was added to package.json and just not installed or was it missing there already?

@thejones
Copy link
Contributor Author

@daffl @ekryski
Maybe node/npm version? I was using 5.4.0 and received the errors. Tried with personal and work laptops with 5.9 & 5.8 respectively and everything was fine.

$nvm use 5.4.0
Now using node v5.4.0 (npm v3.3.12)

Package.json...

  "dependencies": {
    "body-parser": "^1.15.0",
    "compression": "^1.6.1",
    "cors": "^2.7.1",
    "feathers": "^2.0.0",
    "feathers-authentication": "^0.4.1",
    "feathers-configuration": "^0.2.1",
    "feathers-errors": "^2.0.1",
    "feathers-hooks": "^1.5.0",
    "feathers-rest": "^1.2.4",
    "feathers-sequelize": "^1.1.4",
    "feathers-socketio": "^1.3.3",
    "passport": "^0.3.2",
    "pg": "^4.5.1",
    "pg-hstore": "^2.3.2",
    "sequelize": "^3.19.3",
    "serve-favicon": "^2.3.0",
    "winston": "^2.2.0"
  },
  "devDependencies": {
    "jshint": "^2.9.1",
    "mocha": "^2.4.5",
    "request": "^2.69.0"
  }

$nvm use default
Now using node v5.8.0 (npm v3.7.3)

  "dependencies": {
    "body-parser": "^1.15.0",
    "compression": "^1.6.1",
    "cors": "^2.7.1",
    "feathers": "^2.0.0",
    "feathers-authentication": "^0.4.1",
    "feathers-configuration": "^0.2.1",
    "feathers-errors": "^2.0.1",
    "feathers-hooks": "^1.5.0",
    "feathers-rest": "^1.2.4",
    "feathers-sequelize": "^1.1.4",
    "feathers-socketio": "^1.3.3",
    "passport": "^0.3.2",
    "pg": "^4.5.1",
    "pg-hstore": "^2.3.2",
    "sequelize": "^3.19.3",
    "serve-favicon": "^2.3.0",
    "winston": "^2.2.0"
  },
  "devDependencies": {
    "jshint": "^2.9.1",
    "mocha": "^2.4.5",
    "request": "^2.69.0"
  }

@ekryski
Copy link
Member

ekryski commented Mar 19, 2016

@thejones thanks! I'm going to double check that as well. It's most likely not the node version but may be a weird edge case we are hitting with npm versions that are now fixed. Unfortunately it is nearly impossible to search npm's github issues for this due to all the issues related to "can't install X".

I'll see if I can reproduce more consistently with older versions of npm.

@lukeed
Copy link

lukeed commented Mar 22, 2016

I'm using Node 5.4.1, just got this error. Downloaded the generator today.

@wagerfield
Copy link

I experienced the same issue with node v5.5.0.

Error: Cannot find module 'feathers-errors/handler'

node_modules/feathers-errors was not installed during the setup.

package.json dependencies look correct:

  "dependencies": {
    "body-parser": "^1.15.0",
    "compression": "^1.6.1",
    "cors": "^2.7.1",
    "feathers": "^2.0.0",
    "feathers-authentication": "^0.7.0",
    "feathers-configuration": "^0.2.2",
    "feathers-errors": "^2.1.0",
    "feathers-hooks": "^1.5.1",
    "feathers-nedb": "^2.2.3",
    "feathers-rest": "^1.2.4",
    "feathers-socketio": "^1.3.3",
    "nedb": "^1.8.0",
    "passport": "^0.3.2",
    "serve-favicon": "^2.3.0",
    "winston": "^2.2.0"
  },
  "devDependencies": {
    "jshint": "^2.9.1",
    "mocha": "^2.4.5",
    "request": "^2.70.0"
  }

Updated my version of node to the latest stable release (v5.10.1) and went through the whole setup again and it worked fine.

@daffl
Copy link
Member

daffl commented Apr 7, 2016

Do the errors go away just when running npm install again?

@ekryski
Copy link
Member

ekryski commented Apr 7, 2016

Yes they do. As far as I can tell this is an open npm issue. You need to do npm install twice because it is not resolving some dependencies for some reason.

@pdrummond
Copy link

I have just discovered FeathersJS and when I went through the tutorial I got this error so I googled it and found this issue. I checked my node and npm version and they were out of date, so I updated and now everything works first time. I ran npm install again and it installed feathers-errors and then it worked fine. I also created a new project using the Feathers CLS (following the tutorial steps just like before) and this time it started fine first time.

When the error occurred my node version was v5.1.0 and npm version was 3.3.12. After updating my node version is v5.10.1 and npm version is 3.8.3.

@ekryski Even though this is technically PICNIC, unfortunately I think many newcomers will assume it's an issue with FeathersJS without giving it much thought. For me, mentioning this error in a side-note in the right place in the docs (and maybe linking to this issue) would be enough to mitigate any negative impression this might otherwise give? I would be happy to update the docs if it's possible to edit them via a pull request or something but I would need a bit of guidance on that (I'm new here so not sure what the right process is for this kind of thing?).

@ekryski
Copy link
Member

ekryski commented Apr 15, 2016

I totally agree @pdrummond. At the top of every page on the docs you can click "edit this page" and it will do a PR. Maybe make it a ProTip so that it is more highlighted. I'd really appreciate it!

@daffl
Copy link
Member

daffl commented Apr 16, 2016

Thank you @pdrummond for the input and the pull request feathersjs-ecosystem/docs#141 for the docs. Since having the latest version of Node and npm seems to fix it I am going to close this issue.

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

6 participants