N8n module error

I Ran npm I command in n8n

Output:
gyp ERR! build error

gyp ERR! stack Error: make failed with exit code: 2

gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/Cellar/[email protected]/14.19.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)

gyp ERR! stack at ChildProcess.emit (events.js:400:28)

gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)

gyp ERR! System Darwin 21.4.0

gyp ERR! command “/opt/homebrew/Cellar/[email protected]/14.19.1/bin/node” “/opt/homebrew/Cellar/[email protected]/14.19.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”

gyp ERR! cwd /Users/priyankanai/n8n/node_modules/cpu-features

gyp ERR! node -v v14.19.1

gyp ERR! node-gyp -v v5.1.0

gyp ERR! not ok

npm WARN @octokit/[email protected] requires a peer of @octokit/[email protected]>=3 but none is installed. You must install peer dependencies yourself.

npm WARN @vue/[email protected] requires a peer of [email protected]>= 1.6.0 < 7.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN @vue/[email protected] requires a peer of [email protected]>= 9.1.0 but none is installed. You must install peer dependencies yourself.

npm WARN @vue/[email protected] requires a peer of [email protected]>= 4.2.1 but none is installed. You must install peer dependencies yourself.

npm WARN @vue/[email protected] requires a peer of [email protected]>= 4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]^6.4.1 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]^7.21.5 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]^4 || ^3 || ^2.3.0 || ^1.7.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]>=9.1.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]>=4.2.1 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]>=4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of [email protected]>=1.6.0 <7.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/cpu-features):

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-gyp rebuild

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

updated 1 package and audited 5147 packages in 12.322s

313 packages are looking for funding

run npm fund for details

found 52 vulnerabilities (2 low, 11 moderate, 39 high)

run npm audit fix to fix them, or npm audit for details

Hey @121810306029_PRIYANK,

Which npm command did you run? It would be very helpful to know exactly what you have done to get to that point. Start from how you got n8n and go from there.

Hey @jon
cloned the n8n git repo
then from the Mac terminal did cd n8n
and then npm install

Still getting this error

Can you try running the lerna command first.

which command to use to run lerna?

The quick version of the process that we have documented is this:

git clone https://github.com/n8n-io/n8n.git
cd n8n
npm install -g lerna
lerna bootstrap --hoist
npm run build

If you follow that from a terminal everything should work, You may also need node 16 which has fixed a couple of build issues for me.

Something seems off there, If are you in the main n8n folder that command should work. Can you check the package.json file you have locally and make sure it matches the one here: n8n/package.json at master · n8n-io/n8n · GitHub

Got it, It worked but still the Vscode is showing error that the modules are not imported
Sorry for the questions trying n8n for the first time

What do you mean? If it build ok the next step would be an npm run dev just to just make sure it can run.

Still getting this error

Oh that is fine and it happens on my dev machine sometimes but it should still allow you to do anything you are after. It could just be a VSCode issue rather than an n8n issue though, If it builds and runs fine then everything will be all good.

while npm run build got this error
lerna ERR! npm run build exited 126 in ‘n8n-editor-ui’

lerna ERR! npm run build exited 126 in ‘n8n-editor-ui’

What else does it say before that? It sounds like maybe the build didn’t complete properly. I just did a clean test on my machine it looks to be working using the steps I put above.

When you had that issue with the build command what was the cause? Was your local file different or was it just a case of being in the wrong directory?

Did you try with node 16 as well?