Picture of Ailiniyazi Maimaiti
Error: Cannot find module 'mongodb'
by Ailiniyazi Maimaiti - Thursday, 24 October 2019, 9:46 AM
 

Hi.

 

Today I saw that there is an upgrade at Adapt Authoring Tools, then I tried to upgrade it by running - node upgrade.js


Then I got:

Node dependencies installed successfully. Web application built successfully. Server has been updated successfully! Adapt authoring tool upgraded to v0.10.1 internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module '../../document' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at compile (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\node_modules\mongoose\lib\services\document\compile.js:18:26) at Model.Document.$__setSchema (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\node_modules\mongoose\lib\document.js:1918:3) at Function.compile (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\node_modules\mongoose\lib\model.js:3955:19) at Mongoose.model (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\node_modules\mongoose\lib\index.js:437:22) at NativeConnection.Connection.model (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\node_modules\mongoose\lib\connection.js:1054:23) at exports.default (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\dist\db.js:41:23) at new Migrator (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\migrate-mongoose\dist\lib.js:102:39) at C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\lib\installHelpers.js:314:22 at xfs.stat (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\fs-extra\lib\mkdirs\mkdirs.js:56:16) at callback (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\graceful-fs\polyfills.js:295:20) at FSReqWrap.oncomplete (fs.js:154:5)

When I tried to launch the server by running - node server, I got this error:

internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module 'mongodb' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\node_modules\connect-mongodb-session\index.js:5:17) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\lib\application.js:39:20) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\xampp\htdocs\adapt\adapt_authoring\adapt_authoring_testing\server.js:1:13) at Module._compile (internal/modules/cjs/loader.js:776:30)

Picture of Ailiniyazi Maimaiti
Re: Error: Cannot find module 'mongodb'
by Ailiniyazi Maimaiti - Friday, 25 October 2019, 3:30 PM
 

Has anybody the same problem?

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