N8n command returns Error: There was an error: require(...).NetlifyOAuth2Api is not a constructor

Describe the issue/error/question

I’m following this tutorial to build my custom node, but when I start n8n, it returns error saying NetlifyOAuth is not a constructor.

What is the error message?

›   Error: There was an error: require(...).NetlifyOAuth2Api is not a constructor

Please share the workflow

$ npm i -g n8n
$ n8n
Initializing n8n process
 ›   Error: There was an error: require(...).NetlifyOAuth2Api is not a constructor

Information on your n8n setup

  • **n8n version: 0.197.1
  • **Database you’re using (default: SQLite): default
  • **Running n8n with the execution process [own(default), main]: own
  • **Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm
  • **Node version: 16.17.1
  • **OS: macOS Monterey 12.5.1
  • **Chip: Apple M1 Pro

Hey @wadwax,
welcome to the community :tada:

This error message usually means that n8n was not able to load a node/credential file. In this case it’s trying to load NetlifyOAuth2Api credentials class, which is uncommented so it can’t load it. But n8n should not try to load it because it is not referenced in the nodes-base package.json (NetlifyApi is referenced and should work).

You are using the n8n-nodes-starter project to develop your node and run npm link to get your node working with the globally installed n8n, right?

  • Do you have a NetlifyOAuth2Api credential reference in your project’s package.json?
  • Does n8n start correctly without your node’s project linked?

To make sure the globally installed n8n is working on its own you could reinstall it:

npm uninstall n8n -g
npm install n8n -g
2 Likes

Hi Marcus, thanks for the prompt response.

I do not have NetlifyOauth setup on my end with n8n-node-starter package. I’ve tried linking it with the global n8n, and also tried running it independently. Both attempts failed with the same error.

I’ve also tried reinstalling global n8n, but it didn’t help.

Hey @wadwax,

Is there any more to the error message?

No there aren’t any more error message. I’ve tried uninstalling nodejs and npm, and installed it again, and now it works. I’m suspecting that having both global n8n and n8n-io/n8n in my machine somehow affected the result.

1 Like

Hey @wadwax,

When you say n8n-io/n8n do you mean docker and npm? On my daily machine I have Desktop, Docker and npm installed the only real catch is making sure I don’t start all 3 at the same time.