Picture of Tom Greenfield
Re: Error: Cannot find module 'mongodb'
by Tom Greenfield - Tuesday, 29 October 2019, 9:44 AM
 

The first error looks to be a symptom of the Node dependencies being upgraded while still use – this can, in theory, be ignored since the module in question is migrate-mongoose, and there aren't any migrations bundled with the 0.10.1 release.

The second error, however, is more crucial. I suggest you try reinstalling the dependencies and rebuilding the app by running:

rm -r node_modules
npm install --production
grunt build:prod
node server
Picture of Tom Greenfield
Re: Error: Cannot find module 'mongodb'
by Tom Greenfield - Monday, 18 November 2019, 9:30 AM
 
Error: Cannot find module 'mongodb'

We actually ran into this the other day on one of our authoring tool instances.

To resolve, we had to navigate to the node_modules/connect-mongodb-session directory and manually run npm install.

Requires further investigation to ascertain the cause and a proper solution.

Tim Baker
Re: Error: Cannot find module 'mongodb'
by Tim Baker - Monday, 18 November 2019, 3:21 PM
 

Tom's proposed solution worked for me. I was updating from a previous version of the Authoring Tool (0.10.0 ??, but I am not sure)

Here is the console output just in case it gives someone a clue about what has gone wrong:

>npm install

npm WARN deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:

npm WARN deprecated   npm i nyc

npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.

npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3

npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN connect-mongodb-session@2.2.0 No license field.

 

added 160 packages from 480 contributors and audited 241 packages in 26.77s

found 14 vulnerabilities (6 low, 2 moderate, 5 high, 1 critical)

  run `npm audit fix` to fix them, or `npm audit` for details

 

  

>npm audit fix

npm WARN connect-mongodb-session@2.2.0 No license field.

+ acquit@1.0.5

+ express@4.17.1

+ express-session@1.17.0

added 20 packages from 14 contributors, removed 4 packages and updated 19 packages in 10.767s

fixed 12 of 14 vulnerabilities in 241 scanned packages

  1 package update for 2 vulns involved breaking changes

  (use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)

 

 

adapt_authoring>node server

info [18 Nov 19 11:32:03 +01:00] configuration loaded from C:\Users\tbaker\Documents\adapt_authoring\conf\config.json

info [18 Nov 19 11:32:04 +01:00] Supporting the following authentication types:

info [18 Nov 19 11:32:04 +01:00] - local

info [18 Nov 19 11:32:06 +01:00] Connection established: adapt-tenant-master

warn [18 Nov 19 11:32:06 +01:00] MongooseDB#addModel: can't overwrite an existing model

error [18 Nov 19 11:32:06 +01:00] Error importing content schema: MongooseDB#addModel - Failed to add the model course: it already exists

info [18 Nov 19 11:32:09 +01:00] Adapt authoring tool 0.10.2.

info [18 Nov 19 11:32:09 +01:00] Adapt framework 2.4.0.

info [18 Nov 19 11:32:10 +01:00] Server started listening on port 5000

=================================

and it works!

Picture of Stephen Harlow
Re: Error: Cannot find module 'mongodb'
by Stephen Harlow - Monday, 18 November 2019, 9:19 PM
 

Thanks Tom, that worked for me.