at Object.<anonymous> (C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sql
ite3\lib\sqlite3-binding.js:4:15)
error MODULE_NOT_FOUND
Dockerfile:
FROM node:12-alpine
RUN apk add --no-cache python g++ make
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
So my question is why it works when copied to Docker container and not locally.
Given that things work in Docker, I feel your question is off-topic on this forum. We also don’t know when the error occurs and what you’ve already done before that, so we’re in the dark with just an error message.
(That said, I’d remove the node_modules directory, run yarn install and carefully watch for any errors before running yarn dev or node src/index.js again, assuming that is what you were running.)
hi
yes deleting the node modules is a good idea
nevertheless it didt work i deleted the node modules folder and lock files
the npm or yarn install is finishing without errors but a lot of deprecated packages. This is an example from the original docker getting started tutorial here on web page any ideas?
here is the log
“C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” run dev --scripts-prepend-node-path=auto
101-app@1.0.0 dev C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app
nodemon src/index.js
[nodemon] 1.19.4
[nodemon] to restart at any time, enter rs
[nodemon] watching dir(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node src/index.js
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module ‘C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sql
ite3\lib\binding\node-v83-win32-x64\node_sqlite3.node’
Require stack:
C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sqlite3\lib\sqlite3-binding.
js
C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sqlite3\lib\sqlite3.js
C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\persistence\sqlite.js
C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\persistence\index.js
C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sql
ite3\lib\sqlite3-binding.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [
‘C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sqlite3\lib\sqlit
e3-binding.js’,
‘C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\sqlite3\lib\sqlit
e3.js’,
‘C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\persistence\sqlite.js’,
‘C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\persistence\index.js’,
‘C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\index.js’
]
}
[nodemon] app crashed - waiting for file changes before starting…
after updating all the dependecies to newer versions the error has gone.
But now i face another error
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dev --scripts-prepend-node-path=auto
> 101-app@1.0.0 dev C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app
> nodemon src/index.js
[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/index.js`
internal/modules/cjs/loader.js:455
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in C:\Users\Ulri
ch Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\uuid\package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:299:9)
at packageExportsResolve (internal/modules/esm/resolve.js:522:3)
at resolveExports (internal/modules/cjs/loader.js:449:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:489:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\routes\addIt
em.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1072:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
[nodemon] app crashed - waiting for file changes before starting...
I guess it is a dependecy not supporting older versions. So tricky like the needle in the hay stack
That may answer the question why the orginal works in Docker: that’s a Linux environment, and maybe the yarn.lock in the GitHub project yields a different dependency resolution for Linux and Windows. I don’t know.
again i needed to update the uuid dependency to uuidv4 because it is required by code
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dev --scripts-prepend-node-path=auto
> 101-app@1.0.0 dev C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app
> nodemon src/index.js
[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/index.js`
Using sqlite database at /etc/todos/todo.db
events.js:377
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::54778
at Server.setupListenHandle [as _listen2] (net.js:1320:16)
at listenInCluster (net.js:1368:12)
at Server.listen (net.js:1454:7)
at Function.listen (C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\node_modules\expres
s\lib\application.js:618:24)
at C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app\src\index.js:19:13
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1347:8)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 54778
}
[nodemon] app crashed - waiting for file changes before starting...
adres is ::
how and where can i change the address to localhost?
i changed adress to localhost and found an open listening port:
but still i get the message port is established or occupated
'"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dev --scripts-prepend-node-path=auto
> 101-app@1.0.0 dev C:\Users\Ulrich Giorgio Jäger\IdeaProjects\docker-tutorial-app
> nodemon src/index.js
[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/index.js`
Using sqlite database at /etc/todos/todo.db
events.js:377
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use 127.0.0.1:6942
at Server.setupListenHandle [as _listen2] (net.js:1320:16)
at listenInCluster (net.js:1368:12)
at doListen (net.js:1505:7)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1347:8)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '127.0.0.1',
port: 6942
}
[nodemon] app crashed - waiting for file changes before starting...
^A
has anybody have an idea on why. this is not working on my local machine after so many updates still the port is being marked as occupied even if its open for new connections