I'm getting this error:
Error: Cannot find module 'debug'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (myapp/node_modules/koa/lib/application.js:8:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
The koa's version in use is the 1.2.4.
Are there someone having this problem too?
What version of npm are you using?
rm -rf node_modules; npm install works almost all the time 馃槅
Thanks for the replies.
@EduardoRFS the npm version is 2.15.1
npm info using [email protected]
@jonathanong I've just did it, without success :(
sudo rm -rf node_modules
why reopen it? it seems to be closed
@i5ting I'm still facing the problem.
What does ls node_modules/debug output? Did npm install run correctly?
Also try npm install koa; npm install debug.
Probably your npm don't install the debug: "*", you can install debug with 枪pm install debug or update the npm
Guys, now my project is running properly.
I have added [email protected] in my package.json.
I noticed that if I let npm resolve the debug dependence based on koa's package.json, my project can't run. This also happens if I add debug > 2.4.5 in my package.json, for example, [email protected].
The package.json that is working has these dependencies:
"dependencies": {
"amqplib": "^0.5.1",
"babel-polyfill": "^6.7.2",
"forever-monitor": "1.2.2",
"graceful-fs": "~4.1.3",
"koa": "^1.2.0",
"koa-body": "^1.4.0",
"koa-compress": "^1.0.9",
"koa-logger": "^1.3.0",
"koa-router": "^5.4.0",
"lodash": "~4.6.1",
"moment": "^2.13.0",
"mongorito": "~2.2.0",
"nodemailer": "^2.3.2",
"nodemailer-smtp-transport": "^2.4.2",
"validator": "^5.1.0",
"debug": "2.4.5"
}
The package.json that isn't working has these dependencies:
"dependencies": {
"amqplib": "^0.5.1",
"babel-polyfill": "^6.7.2",
"forever-monitor": "1.2.2",
"graceful-fs": "~4.1.3",
"koa": "^1.2.0",
"koa-body": "^1.4.0",
"koa-compress": "^1.0.9",
"koa-logger": "^1.3.0",
"koa-router": "^5.4.0",
"lodash": "~4.6.1",
"moment": "^2.13.0",
"mongorito": "~2.2.0",
"nodemailer": "^2.3.2",
"nodemailer-smtp-transport": "^2.4.2",
"validator": "^5.1.0",
"debug": "2.5.1"
}
Or this, if I let koa resolve the dependencies:
"dependencies": {
"amqplib": "^0.5.1",
"babel-polyfill": "^6.7.2",
"forever-monitor": "1.2.2",
"graceful-fs": "~4.1.3",
"koa": "^1.2.0",
"koa-body": "^1.4.0",
"koa-compress": "^1.0.9",
"koa-logger": "^1.3.0",
"koa-router": "^5.4.0",
"lodash": "~4.6.1",
"moment": "^2.13.0",
"mongorito": "~2.2.0",
"nodemailer": "^2.3.2",
"nodemailer-smtp-transport": "^2.4.2",
"validator": "^5.1.0"
}
It seems there is a conflict between koa and debug versions.
Thanks all for the help.
weird, looks like an npm bug to me!
I had this same problem pop up where it previously had not. It was occurring for me with an alpha version of koa2. I've moved to koa 2.2 and it is gone.
Most helpful comment
rm -rf node_modules; npm installworks almost all the time 馃槅