External javascript libraries for code/function node

Hi All,

I have a nice server on Hertzner (4 cores, 16GB ram) fully dedicated to n8n. I opted for the npm installation, as I need multiple npm packages installed for my code/function node. NPM is up and running and I followed the: How to set up n8n via PM2 – n8n Blog for this.

Now I also followed: Configuration methods | n8n Docs to install my packages (ethers, web3, solc, MythXjs). Now when I tryed to start my n8n again, it gives a isomorphic error.

Quick search revealed this should be due to one of the packages might be browser only instead of node.js (server-side). I find this a bit odd as all 4 are npm packages which is specific to node.js itself.

Anyone else encountered such issues before?

Information on your n8n setup

  • **n8n version:1.4.1
  • **Database (default: SQLite):SQLite
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):own, main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): NPM
  • **Operating system:Linux, Ubuntu

Hey @Bryce,

Can you share the error you are getting when starting up n8n? I have seen packages on npm that are tergetted for browsers so there could be something there.

root@npm-n8n:~# n8n start
Loading config overwrites [ ‘/root/n8n-config.json’ ]
Error loading node “isomorphic” from: “/usr/lib/node_modules/@jsdevtools/ono/cjs/isomorphic.node.js” - require(…).isomorphic is not a constructor
new (require(‘/usr/lib/node_modules/@jsdevtools/ono/cjs/isomorphic.node.js’).isomorphic)()

TypeError: require(…).isomorphic is not a constructor
at evalmachine.:1:1
at Script.runInContext (node:vm:135:12)
at loadClassInIsolation (/usr/lib/node_modules/n8n/node_modules/n8n-core/src/ClassLoader.ts:9:16)
at CustomDirectoryLoader.loadNodeFromFile (/usr/lib/node_modules/n8n/node_modules/n8n-core/src/DirectoryLoader.ts:75:35)
at CustomDirectoryLoader.loadAll (/usr/lib/node_modules/n8n/node_modules/n8n-core/src/DirectoryLoader.ts:288:10)
at LoadNodesAndCredentials.runDirectoryLoader (/usr/lib/node_modules/n8n/src/LoadNodesAndCredentials.ts:328:3)
at LoadNodesAndCredentials.loadNodesFromCustomDirectories (/usr/lib/node_modules/n8n/src/LoadNodesAndCredentials.ts:173:4)
at LoadNodesAndCredentials.init (/usr/lib/node_modules/n8n/src/LoadNodesAndCredentials.ts:86:3)
at Start.init (/usr/lib/node_modules/n8n/src/commands/BaseCommand.ts:50:3)
at Start.init (/usr/lib/node_modules/n8n/src/commands/start.ts:191:3)
AError: Exiting due to an error.
TypeError: require(…).isomorphic is not a constructor

I did a clean install locally on my PC (windows) and now did the npm install but without the configuration file, but normal commands (the exports, but then set since its windows). And it works :wink: I’m working on creating a bash script, which will automatically do a nice install, set all environmental variables (including timezone, timeouts, https, webhooks etc),

When this is done and it works on Hertzner, I will share it :slight_smile: