I am beginner and cannot understand the error message. After running app.js file I am getting following log message. On some search I found that I have to upgrade my MongoDB but as I am working in windows 7 it is not possible.
PS G:\AWebDev\Website\Dance website> node app.js
internal/modules/cjs/loader.js:628
throw e;
^
Error: No valid exports main found for 'G:\AWebDev\Website\Dance website\node_modules\mongodb-connection-string-url'
←[90m at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)←[39m
←[90m at applyExports (internal/modules/cjs/loader.js:502:14)←[39m
←[90m at resolveExports (internal/modules/cjs/loader.js:551:12)←[39m
←[90m at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)←[39m
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:855:27)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:1033:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:72:18)←[39m
at Object.<anonymous> (G:\AWebDev\Website\Dance website\node_modules\←[4mmongodb←[24m\lib\connection_string.js:6:41)
←[90m at Module._compile (internal/modules/cjs/loader.js:1144:30)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m
}
CodePudding user response:
Have you tried using the cmd to run the server instead of the Node.js terminal? It usually fixes these issues on Windows 7.
CodePudding user response:
it would have been helpful to see your code. but my wild guess is that you are probably using import statement instead of require.
instead of using import {something} from 'something' use const something = require('something');
CodePudding user response:
Upgrading Nodejs to v13.12.0 for Windows 7 resolves the problem.