keystone-classic: Failed to load c++ bson extension

tried following a yo generator install of keystone but getting this error

$ node keystone
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version

I only get the server running when I stop and restart the terminal - any thoughts on removing the error

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 23 (4 by maintainers)

Most upvoted comments

Just upgraded to the master branch, the error is gone.

In package.json:

"keystone": "https://github.com/keystonejs/keystone.git",

Then

rm -rf node_modules
npm install

Ainsss…

I think is not necessary ninja tricks for solving this problem.

After creating your keystone project, install npm-check-updates for all users:

user@debian:~/myproject/my-site$ sudo npm install -g npm-check-updates

Then update your site packages.json:

user@debian:~/myproject/my-site$ npm-check-updates -u

And finally update all packages:

user@debian:~/myproject/my-site$ npm install

One last thing. If you chose ‘jade’ during deployment of keystone, maybe you will need to install ‘jade’ explicitly:

user@debian:~/myproject/my-site$ npm install jade --save

As @snowkeeper alluded, for Node 4 at least, this error is entirely upstream. It originates in the bson package itself, which the mongodb package depends on, which mongoose depends on. The error was corrected right around bson@4.20.

@fridays’s suggestion to use the unstable Keystone 0.4.x alpha branch from master eliminates the error as the mongoose dependency was updated, resulting in a bson 4 dependency.

If Keystone 0.3.x is to be maintained, the solution is to bump the mongoose dependency from ~3.8.35 to ^4.1.3. There are backwards incompatible changes between Mongoose 3 and 4 - so Keystone updates might have to be backported from 0.4.x, or applied separately if 0.4.x is largely incompatible.

All of that said, since a pure JS fallback is available for bson and this error does not impede execution, I can’t imagine that this issue should take much priority!

@manuel-alcocer : thank you, this was the only solution i found that worked for running Keystone.

Cheers 👍