Error import socket io

Hi,

I try to use socket.io client but i’v got ERROR: ‘import’ and ‘export’ may only appear at the top level

// ES6 import or TypeScript
import { io } from "socket.io-client";
// CommonJS
const io = require("socket.io-client");

What i do is to install socket.io from npm install n8n [email protected]
then i add in ma env VAR :
NODE_FUNCTION_ALLOW_EXTERNAL=socket.io,socket.io-client

have an idea ?

Hey @Jeremy_Bepoix, are you also getting an error when using the CommonJS syntax from your snippet (const io = require("socket.io-client");)? That way you wouldn’t be using import.

same issue