how to install node packages, where’s the node_modules?
I’d like to use external library from node modules like sanitize-html module.
Please guide me on how to make it work as it doesn’t work now.
You can use the wildcard value for the external npm modules you want to allow instead of specifying the individual name. I’d also recommend checking to make sure you’re installing them globally, and rebuilding your docker container.
if my installation folder that contains docker-compose.yml is in this path ~/n8n_new/, where is external node_modules relative to that path?
Is external node_modules means that it’s located inside this folder ~/n8n_new/?
I have tried rebuild but with NODE_FUNCTION_ALLOW_EXTERNAL set to wildcard and have node_modules inside the installation folder, unfortunately it’s still doesn’t work
Fortunately Cherio package is already included in n8n by default, so it’s not a problem.
But I have issues adding different packages like sanitize-html.
Below is a new log, i desparately need this package sanitize-html.
Please help me guys
VMError: Cannot find module 'sanitize-html' at LegacyResolver.resolveFull (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/resolver.js:126:9) at LegacyResolver.resolveFull (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/resolver.js:316:16) at LegacyResolver.resolveFull (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/resolver-compat.js:147:17) at LegacyResolver.resolve (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/resolver.js:121:15) at resolve (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/nodevm.js:317:21) at VM2 Wrapper.apply (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/bridge.js:485:11) at requireImpl (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/setup-node-sandbox.js:90:19) at require (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/setup-node-sandbox.js:171:10) at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:2:1 at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:6:2
Hi there! Glad to hear you are unblocked. The dependencies need to be installed globally inside the container, which you are getting around to by accessing the container and doing it manually there.
Also feel free to check out Docker’s documentation for additional details around some of the flags you’re using when running your compose commands.
If I do it using Dockerfile, yes the server is up but it isn’t accessible, meaning error.
Dockerfile
FROM n8nio/n8n
USER root
RUN npm install -g mout iso-3166-1-alpha-2 mysql @hubspot/api-client axios sanitize-html dom-parser bottleneck node-html-parser html-table-to-json cheerio
USER node