When opening a interactive node shell not inside the root directory of graphql-server and requiring e.g.
var m = require('./graphql-server/models_index.js')
You get an error
Uncaught Error: ENOENT: no such file or directory, scandir './models'
at Object.readdirSync (fs.js:872:3)
at Object.<anonymous> (/home/cons/EMPHASIS-Layer/cenzontle_git_projects/Sandbox_real/SIAGRO/instance_3_gef/graphql-server/models_index.js:13:4)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18) {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: './models'
}
Fix this by using path specifications that work always independently of from where models_index.js is required.
When opening a interactive node shell not inside the root directory of
graphql-server
and requiring e.g.You get an error
Fix this by using path specifications that work always independently of from where
models_index.js
is required.Look at
__dirname
and path.