Describe the problem/error/question
I am trying to install this npm package (@tryfabric) and use it in a “code” node in NPM. I have created a dockerfile, added it to docker-compose.yml, built docker image, but still get “Module_not_found” and VM error when trying to access the package in the code node.
I tried both installing the package globally and in the directory of the node_modules. I do see that the @tryfabric module is present there.
What is the error message (if any)?
node
Uncaught ReferenceError: node is not defined
require(‘@tryfabric/martian’);
Uncaught Error: Cannot find module ‘@tryfabric/martian’
Require stack:
- at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15) at Module._load (node:internal/modules/cjs/loader:922:27) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:119:18) { code: 'MODULE_NOT_FOUND', requireStack: [ '' ]
Please share your workflow
Share the output returned by the last node
ERROR: Cannot find module ‘@tryfabric/martian’ [line 1]
VMError
Tried this Dockerfile content:
Dockerfile
USER root
RUN npm install -g @tryfabric/martian
USER node
Separately tried this dockerfile too:
GNU nano 6.2 dockerfile
FROM n8nio/n8n:latest
USER root
Change the working directory
WORKDIR /usr/local/lib/node_modules/n8n
Install the module in the local n8n node_modules directory
RUN npm install @tryfabric/martian
Revert to the default working directory
WORKDIR /data
Switch back to the node user for security purposes
USER node
Docker-compose.yml
@tryfabric module is present in this directory: /usr/local/lib/node_modules/n8n/node_modules/@tryfabric
This is how I build the docker image:
Stop current setup
sudo docker-compose stop
Delete it (will only delete the docker-containers, data is stored separately)
sudo docker-compose rm
Pull the (latest) image not Next (to do that specify the version in docker-compose.yml
sudo docker build --no-cache -t dockerfile .
Then start it again
sudo docker-compose up -d
Information on your n8n setup
- **n8n version:**1.22.3
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**Docker