Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js ERROR Error: Cannot find module 'bluebird'

Tags:

node.js

hexo

When I try this,it throw an error,how can I solve it?

$ hexo generate
ERROR Error: Cannot find module 'bluebird'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/lihz/blog/node_modules/hexo/lib/hexo/index.js:3:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /usr/local/lib/node_modules/hexo-cli/lib/index.js:73:18
    at tryCatcher (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/promise.js:489:31)
    at Promise._settlePromiseAt (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/promise.js:565:18)
    at Promise._settlePromises (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/promise.js:681:14)
Unhandled rejection TypeError: Cannot call method 'then' of undefined
    at /usr/local/lib/node_modules/hexo-cli/lib/index.js:82:22
    at tryCatcher (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/promise.js:489:31)
    at Promise._settlePromiseAt (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/promise.js:565:18)
    at Async._drainQueue (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/async.js:133:10)
    at Async.drainQueues (/usr/local/lib/node_modules/hexo-cli/node_modules/bluebird/js/main/async.js:15:14)
    at process._tickCallback (node.js:442:13)
like image 231
Lihz Avatar asked Dec 08 '22 02:12

Lihz


2 Answers

In my case the Bluebird folder was called 'bluebird' and i was importing it as 'Bluebird' (with a capital 'B') so i changed the import string to be 'bluebird' (im working on linux).

Hope this helps someone.

like image 44
alvarosmh Avatar answered Dec 27 '22 19:12

alvarosmh


You might need to install the bluebird package locally. Try

npm install --save bluebird
like image 193
veggiesaurus Avatar answered Dec 27 '22 20:12

veggiesaurus