Error: Cannot find module 'bson'


#1

I’m getting this when I do “meteor run”. I’m on Windows 8.1 64-bit. I started getting this on Meteor 1.4.2.2 so I updated to the latest patch (1.4.2.3) but that made no difference. I also did “meteor update”, which updated minimongo to version 1.0.19.

W20161120-07:32:41.014(-5)? (STDERR) C:\Users\mhl\Google Drive\Quarule\QREBuilder_Meteor_1.4.meteor\local\build\programs\server\boot.js:348
W20161120-07:32:41.015(-5)? (STDERR) }).run();
W20161120-07:32:41.016(-5)? (STDERR) ^
W20161120-07:32:41.017(-5)? (STDERR)
W20161120-07:32:41.018(-5)? (STDERR) Error: Cannot find module 'bson’
W20161120-07:32:41.019(-5)? (STDERR) at Function.Module._resolveFilename (module.js:325:15)
W20161120-07:32:41.019(-5)? (STDERR) at Function.Module._load (module.js:276:25)
W20161120-07:32:41.020(-5)? (STDERR) at Module.require (module.js:353:17)
W20161120-07:32:41.020(-5)? (STDERR) at require (internal/module.js:12:17)
W20161120-07:32:41.021(-5)? (STDERR) at Object. (C:\Users\mhl\AppData\Local.meteor\packages\npm-mongo\2.2.11_2\npm\node_modules\mongodb-core\lib\connection\commands.js:4:12)
W20161120-07:32:41.022(-5)? (STDERR) at Module._compile (module.js:409:26)
W20161120-07:32:41.022(-5)? (STDERR) at Object.Module._extensions…js (module.js:416:10)
W20161120-07:32:41.023(-5)? (STDERR) at Module.load (module.js:343:32)
W20161120-07:32:41.024(-5)? (STDERR) at Function.Module._load (module.js:300:12)
W20161120-07:32:41.025(-5)? (STDERR) at Module.require (module.js:353:17)
=> Exited with code: 1

Here are the installed packages:

meteor list
accounts-password 1.3.3 Password support for accounts
accounts-ui 1.1.9 Simple templates to add login widgets to an app
ajduke:bootstrap-tagsinput 0.7.1 jQuery plugin providing a Twitter Bootstrap user interface for managing tags, repackaged for Meteor
aldeed:autoform 5.8.1 Easily create forms with automatic insert and update, and automatic reactive validation.
aldeed:collection2 2.10.0 Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema 1.5.3 A simple schema validation object with reactivity. Used by collection2 and autoform.
audit-argument-checks 1.0.7 Try to detect inadequate input sanitization
blaze-html-templates 1.0.5 Compile HTML templates into reactive UI with Meteor Blaze
browser-policy 1.0.9 Configure security policies enforced by the browser
check 1.2.4 Check whether a value matches a pattern
ecmascript 0.6.1 Compiler plugin that supports ES2015+ in all .js files
ejson 1.0.13 Extended and Extensible JSON library
es5-shim 4.6.15 Shims and polyfills to improve ECMAScript 5 support
http 1.2.10 Make HTTP calls to remote servers
jquery 1.11.10 Manipulate the DOM using CSS selectors
less 2.7.8 Leaner CSS language
meteor-base 1.0.4 Packages that every Meteor app needs
meteorhacks:fast-render 2.16.0 Render your app before the DDP connection even comes alive - magic?
mobile-experience 1.0.4 Packages for a great mobile user experience
mongo 1.1.14 Adaptor for using MongoDB and Minimongo over DDP
reactive-var 1.0.11 Reactive variable
semantic:ui 2.2.1 Official Semantic UI Integration for Meteor
session 1.1.7 Session variable
shell-server 0.2.1 Server-side component of the meteor shell command.
standard-minifier-css 1.3.2 Standard css minifier used with Meteor apps by default.
standard-minifier-js 1.2.1 Standard javascript minifiers used with Meteor apps by default.
tracker 1.1.1 Dependency tracker to allow reactive callbacks
twbs:bootstrap 3.3.6 The most popular front-end framework for developing responsive, mobile first projects on the web.
ultimatejs:tracker-react 1.0.5 No-Config reactive React Components with Meteor. Apply as composition, mixin or decorator.
underscore 1.0.10 Collection of small helpers: _.map, _.each, …

And the npm packages:

meteor npm list
QRBuilder_Meteor_1.4@0.0.0 C:\Users\mhl\Google Drive\Quarule\QREBuilder_Meteor_1.4
±- babel-eslint@7.1.1
| ±- babel-code-frame@6.16.0
| ±- babel-traverse@6.18.0
| | -- babel-messages@6.8.0 | +-- babel-types@6.18.0 | |– to-fast-properties@1.0.2
| ±- babylon@6.13.1
| -- lodash.pickby@4.6.0 +-- babel-runtime@6.18.0 |– regenerator-runtime@0.9.6
±- bootstrap@3.3.7
±- core-js@2.4.1
±- css@2.2.1
| ±- inherits@2.0.3
| ±- source-map@0.1.43
| | -- amdefine@1.0.0 | +-- source-map-resolve@0.3.1 | | +-- atob@1.1.3 | | +-- resolve-url@0.2.1 | |– source-map-url@0.3.0
| -- urix@0.1.0 +-- deep-equal@1.0.1 +-- double-ended-queue@2.1.0-0 +-- encoding@0.1.12 +-- eslint@3.10.2 | +-- chalk@1.1.3 | | +-- ansi-styles@2.2.1 | | +-- escape-string-regexp@1.0.5 | | +-- has-ansi@2.0.0 | | +-- strip-ansi@3.0.1 | |– supports-color@2.0.0
| ±- concat-stream@1.5.2
| | ±- inherits@2.0.3
| | ±- readable-stream@2.0.6
| | | ±- core-util-is@1.0.2
| | | ±- process-nextick-args@1.0.7
| | | ±- string_decoder@0.10.31
| | | -- util-deprecate@1.0.2 | |– typedarray@0.0.6
| ±- debug@2.3.2
| | -- ms@0.7.2 | +-- doctrine@1.5.0 | |– isarray@1.0.0
| ±- escope@3.6.0
| | ±- es6-map@0.1.4
| | | ±- d@0.1.1
| | | ±- es5-ext@0.10.12
| | | ±- es6-iterator@2.0.0
| | | ±- es6-set@0.1.4
| | | ±- es6-symbol@3.1.0
| | | -- event-emitter@0.3.4 | | +-- es6-weak-map@2.0.1 | |– esrecurse@4.1.0
| | -- estraverse@4.1.1 | +-- espree@3.3.2 | | +-- acorn@4.0.3 | |– acorn-jsx@3.0.1
| | -- acorn@3.3.0 | +-- estraverse@4.2.0 | +-- esutils@2.0.2 | +-- file-entry-cache@2.0.0 | |– flat-cache@1.2.1
| | ±- circular-json@0.3.1
| | ±- del@2.2.2
| | | ±- globby@5.0.0
| | | | ±- array-union@1.0.2
| | | | | -- array-uniq@1.0.3 | | | |– arrify@1.0.1
| | | ±- is-path-cwd@1.0.0
| | | ±- is-path-in-cwd@1.0.0
| | | | -- is-path-inside@1.0.0 | | | +-- pify@2.3.0 | | |– rimraf@2.5.4
| | ±- graceful-fs@4.1.10
| | -- write@0.2.1 | +-- glob@7.1.1 | | +-- fs.realpath@1.0.0 | | +-- inflight@1.0.6 | | |– wrappy@1.0.2
| | ±- once@1.4.0
| | -- path-is-absolute@1.0.1 | +-- globals@9.13.0 | +-- ignore@3.2.0 | +-- imurmurhash@0.1.4 | +-- inquirer@0.12.0 | | +-- ansi-escapes@1.4.0 | | +-- ansi-regex@2.0.0 | | +-- cli-cursor@1.0.2 | | |– restore-cursor@1.0.1
| | | ±- exit-hook@1.1.1
| | | -- onetime@1.1.0 | | +-- cli-width@2.1.0 | | +-- figures@1.7.0 | | +-- readline2@1.0.1 | | | +-- code-point-at@1.1.0 | | | +-- is-fullwidth-code-point@1.0.0 | | | |– number-is-nan@1.0.1
| | | -- mute-stream@0.0.5 | | +-- run-async@0.1.0 | | +-- rx-lite@3.1.2 | | +-- string-width@1.0.2 | |– through@2.3.8
| ±- is-my-json-valid@2.15.0
| | ±- generate-function@2.0.0
| | ±- generate-object-property@1.2.0
| | | -- is-property@1.0.2 | | +-- jsonpointer@4.0.0 | |– xtend@4.0.1
| ±- is-resolvable@1.0.0
| | -- tryit@1.0.3 | +-- js-yaml@3.7.0 | | +-- argparse@1.0.9 | | |– sprintf-js@1.0.3
| | -- esprima@2.7.3 | +-- json-stable-stringify@1.0.1 | |– jsonify@0.0.0
| ±- levn@0.3.0
| | ±- prelude-ls@1.1.2
| | -- type-check@0.3.2 | +-- lodash@4.16.6 | +-- mkdirp@0.5.1 | |– minimist@0.0.8
| ±- natural-compare@1.4.0
| ±- optionator@0.8.2
| | ±- deep-is@0.1.3
| | ±- fast-levenshtein@2.0.5
| | -- wordwrap@1.0.0 | +-- path-is-inside@1.0.2 | +-- pluralize@1.2.1 | +-- progress@1.1.8 | +-- require-uncached@1.0.3 | | +-- caller-path@0.1.0 | | |– callsites@0.2.0
| | -- resolve-from@1.0.1 | +-- shelljs@0.7.5 | | +-- interpret@1.0.1 | |– rechoir@0.6.2
| ±- strip-bom@3.0.0
| ±- strip-json-comments@1.0.4
| ±- table@3.8.3
| | ±- ajv@4.9.0
| | | -- co@4.6.0 | | +-- ajv-keywords@1.1.1 | | +-- slice-ansi@0.0.4 | |– string-width@2.0.0
| | -- is-fullwidth-code-point@2.0.0 | +-- text-table@0.2.0 |– user-home@2.0.0
| -- os-homedir@1.0.2 +-- eslint-config-airbnb@13.0.0 |– eslint-config-airbnb-base@10.0.1
±- eslint-import-resolver-meteor@0.3.3
| -- resolve@1.1.7 +-- eslint-plugin-import@2.2.0 | +-- builtin-modules@1.1.1 | +-- contains-path@0.1.0 | +-- eslint-import-resolver-node@0.2.3 | +-- eslint-module-utils@2.0.0 | | +-- debug@2.2.0 | | |– ms@0.7.1
| | -- pkg-dir@1.0.0 | +-- has@1.0.1 | |– function-bind@1.1.0
| ±- lodash.cond@4.5.2
| ±- minimatch@3.0.3
| | -- brace-expansion@1.1.6 | | +-- balanced-match@0.4.2 | |– concat-map@0.0.1
| -- pkg-up@1.0.0 |– find-up@1.1.2
| ±- path-exists@2.1.0
| -- pinkie-promise@2.0.1 |– pinkie@2.0.4
±- eslint-plugin-jsx-a11y@2.2.3
| ±- damerau-levenshtein@1.0.3
| -- jsx-ast-utils@1.3.4 +-- eslint-plugin-meteor@4.0.1 | +-- babel-register@6.16.3 | | +-- babel-core@6.18.2 | | | +-- babel-generator@6.18.0 | | | | +-- detect-indent@4.0.0 | | | | |– repeating@2.0.1
| | | | | -- is-finite@1.0.2 | | | |– jsesc@1.3.0
| | | ±- babel-helpers@6.16.0
| | | ±- babel-register@6.18.0
| | | | -- home-or-tmp@2.0.0 | | | +-- babel-template@6.16.0 | | | +-- convert-source-map@1.3.0 | | | +-- json5@0.5.0 | | | +-- private@0.1.6 | | | +-- slash@1.0.0 | | |– source-map@0.5.6
| | ±- home-or-tmp@1.0.0
| | | ±- os-tmpdir@1.0.2
| | | -- user-home@1.1.1 | | +-- path-exists@1.0.0 | |– source-map-support@0.4.6
| ±- babel-runtime@6.11.6
| ±- invariant@2.2.1
| ±- lodash.find@4.6.0
| ±- lodash.memoize@4.1.2
| -- path-exists@3.0.0 +-- eslint-plugin-react@6.7.1 +-- fbjs@0.8.6 |– core-js@1.2.7
±- history@4.4.0
| ±- resolve-pathname@2.0.2
| ±- value-equal@0.1.1
| -- warning@3.0.0 +-- hoist-non-react-statics@1.2.0 +-- iconv-lite@0.4.13 +-- immutable@3.8.1 +-- invariant@2.2.2 +-- is-stream@1.1.0 +-- isomorphic-fetch@2.2.1 |– node-fetch@1.6.3
| ±- encoding@0.1.12
| | -- iconv-lite@0.4.13 |– is-stream@1.1.0
±- js-tokens@2.0.0
±- lib@1.0.5
| ±- api-res@0.0.7
| ±- async@2.1.2
| ±- cmnd@0.1.3
| | -- colors@1.1.2 | +-- f@1.1.0 | +-- inquirer@0.11.4 | | +-- cli-width@1.1.1 | |– lodash@3.10.1
| -- tar-stream@1.5.2 | +-- bl@1.1.2 |– end-of-stream@1.1.0
| -- once@1.3.3 +-- loose-envify@1.3.0 |– js-tokens@2.0.0
±- object-assign@4.1.0
±- promise@7.1.1
| -- asap@2.0.5 +-- query-string@4.2.3 |– strict-uri-encode@1.1.0
±- react@15.4.0
±- react-addons-create-fragment@15.4.0
±- react-addons-css-transition-group@15.4.0
±- react-addons-linked-state-mixin@15.4.0
±- react-addons-perf@15.4.0
±- react-addons-pure-render-mixin@15.4.0
±- react-addons-test-utils@15.4.0
±- react-addons-transition-group@15.4.0
±- react-addons-update@15.4.0
±- react-dom@15.4.0
±- react-router@2.8.1
| ±- history@2.1.2
| | ±- deep-equal@1.0.1
| | ±- query-string@3.0.3
| | | -- strict-uri-encode@1.1.0 | |– warning@2.1.0
| ±- hoist-non-react-statics@1.2.0
| -- invariant@2.2.1 +-- strict-uri-encode@2.0.0 +-- ua-parser-js@0.7.12 +-- warning@3.0.0– whatwg-fetch@1.1.1


#2

I took a look at the mongodb package on my file system, at C:\Users\mhl\AppData\Local.meteor\packages\npm-mongo\2.2.11_2\npm\node_modules, and I observe the following:

  • There is a “bson” sub-folder.
  • That folder has “alternate_parsers”, “browser_build”, and “tools” folders that are dated from yesterday, which is when my problem started. “browser_build” contains 2 files (".meteor-portable" and “package.json”) dated Nov. 8. The other 2 folders are empty.
  • This version of bson appears to be bson-0.5.6.

#3

I fixed this problem, I guess.

I opened a command shell in C:\Users\mhl\AppData\Local.meteor\packages\npm-mongo\2.2.11_2\npm and did:

  • npm remove bson
  • npm install bson

Now it shows I have bson@0.5.7. And “meteor run” works!