Starting n8n fails with EBUSY error

Hi All,
Relative newbie here excited to get started with n8n. I have it running on several different platforms currently including Docker and Windows10 with npm.

I am currently trying to install with npm on Windows Server 2016 VMware machine.

Below is the output of the startup command n8n.cmd

C:\Users\myuser\AppData\Roaming>n8n
Initializing n8n process
UserSettings were generated and saved to: C:\Users\myuser\.n8n\config
Migrations in progress, please do NOT stop the process.
 »   Error: There was an error: EBUSY: resource busy or locked, copyfile
 »   'C:\Users\myuser\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\dist\nodes\Google\Gmail\gmail.svg' ->
 »   'C:\Users\myuser\.cache\n8n\public\icons\nodes\n8n-nodes-base.gmail.svg'

C:\Users\myuser\AppData\Roaming>

If I try to run the command again, I get the following error:

  Initializing n8n process
  Migrations in progress, please do NOT stop the process.
  Migration "CreateTagEntity1617213344594" failed, error: SQLITE_ERROR: table "tag_entity" already exists
  There was an error initializing DB: "SQLITE_ERROR: table "tag_entity" already exists"
  
  Stopping n8n...

C:\Users\myuser\AppData\Roaming\npm>

Follwing the thread [here]: (Latest Update causing issues "SQLITE_ERROR: table "temporary user" already exists") I have deleted the database and restarted n8n with the following results:

  C:\Users\myuser\AppData\Roaming\npm>n8n.cmd
  Initializing n8n process
  Migrations in progress, please do NOT stop the process.
   »   Error: There was an error: EBUSY: resource busy or locked, copyfile 'C:\Users\myuser\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\dist\nodes\Google\Gmail\gmail.svg' ->
   »   'C:\Users\myuser\.cache\n8n\public\icons\nodes\n8n-nodes-base.gmail.svg'
  
  C:\Users\myuser\AppData\Roaming\npm>

The cycle just repeats from the first issue at the top.

Information on your n8n setup

  • n8n version:0.209.3
  • **Database: SQLite **
  • Running n8n with the execution process: n8n.cmd
  • Running n8n via npm

Hi @networksup, welcome to the community :tada:

The EBUSY error message suggest a file n8n is trying to access is currently locked by another process (perhaps another instance of n8n, executed in the background by some process manage depending on how you’ve previously deployed n8n).

You might want to check some of the suggestions on SO threads around this problem (for example node.js - Error: EBUSY: resource busy or locked, rmdir - Stack Overflow) to isolate and terminate whichever process might be using the specific file in question.

@MutedJam , thank you for the response. I had used the resource manager before to attemp to locate the conflict. I am unable to find the file in use by any process. All the previous instances were installed on different servers, so I am confident that there is no other n8n instance that is running.

Below are some of the steps I have taken to resolve the issue:
Use resource monitor to locate the files in use indicated in the error message.
I have so far been unable to locate any of the files as being in use.

resource monitor does not show the gmail files in use at any time

Uninstall n8n:

C:\Users\1083790\AppData\Roaming\npm>npm uninstall n8n -g
removed 1346 packages, and audited 1 package in 17s
found 0 vulnerabilities

Delete all directorys and command files with n8n.
Check to make sure all files have been deleted:

C:\Users\myuser\AppData\Roaming\npm\node_modules>dir
Volume in drive C is Windows
Volume Serial Number is 663C-E45E

Directory of C:\Users\myuser\AppData\Roaming\npm\node_modules

12/29/2022  10:40 AM    <DIR>          .
12/29/2022  10:40 AM    <DIR>          ..
			0 File(s)              0 bytes
			2 Dir(s)  137,698,406,400 bytes free

C:\Users\myuser\AppData\Roaming\npm\node_modules>cd ..

Re-nstall n8n with npm:

C:\Users\myuser\AppData\Roaming\npm>npm install n8n -g
npm WARN deprecated @types/[email protected]: This is a stub types definition. express-unless provides its own type definitions, so you do not need this installed.
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 1346 packages, and audited 1347 packages in 2m

121 packages are looking for funding
  run `npm fund` for details

12 vulnerabilities (6 moderate, 6 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Try to run npm audit fix:
Not sure if this is an issue.

C:\Users\1083790\AppData\Roaming\npm>npm audit fix
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\1083790\AppData\Local\npm-cache\_logs\2022-12-29T16_10_34_549Z-debug-0.log

Check to see if the n8n directories were created:

C:\Users\1083790\AppData\Roaming\npm>dir
 Volume in drive C is Windows
 Volume Serial Number is 663C-E45E

 Directory of C:\Users\1083790\AppData\Roaming\npm

12/29/2022  11:05 AM    <DIR>          .
12/29/2022  11:05 AM    <DIR>          ..
12/29/2022  11:05 AM               310 n8n
12/29/2022  11:05 AM               326 n8n.cmd
12/29/2022  11:05 AM               809 n8n.ps1
12/29/2022  11:04 AM    <DIR>          node_modules
			   3 File(s)          1,445 bytes
			   3 Dir(s)  137,007,652,864 bytes free

Start n8n with command:

C:\Users\myuser\AppData\Roaming\npm>n8n.cmd
Initializing n8n process
UserSettings were generated and saved to: C:\Users\myuser\.n8n\config
Migrations in progress, please do NOT stop the process.
 »   Error: There was an error: EBUSY: resource busy or locked, copyfile 'C:\Users\myuser\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\dist\nodes\Google\Gmail\gmail.svg' ->
 »   'C:\Users\myuser\.cache\n8n\public\icons\nodes\n8n-nodes-base.gmail.svg'

C:\Users\myuser\AppData\Roaming\npm>

Check resource monitor for file handles in use
NONE FOUND

Attempt to start n8n again with command:

C:\Users\myuser\AppData\Roaming\npm>n8n.cmd
Initializing n8n process
Migrations in progress, please do NOT stop the process.
Migration "CreateTagEntity1617213344594" failed, error: SQLITE_ERROR: table "tag_entity" already exists
There was an error initializing DB: "SQLITE_ERROR: table "tag_entity" already exists"

Stopping n8n...

C:\Users\myuser\AppData\Roaming\npm>

Delete database.sqlite file
Attempt to start n8n again with command:

C:\Users\myuser\AppData\Roaming\npm>n8n.cmd
Initializing n8n process
Migrations in progress, please do NOT stop the process.
 »   Error: There was an error: EBUSY: resource busy or locked, copyfile 'C:\Users\myuser\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\dist\nodes\Todoist\todoist.svg' ->
 »   'C:\Users\myuser\.cache\n8n\public\icons\nodes\n8n-nodes-base.todoist.svg'

C:\Users\myuser\AppData\Roaming\npm>

We no longer have the database error, but are back to the EBUSY error, but now on a different SVG file.
Again, searching resource monitor handles does not find the file in use.

If I try to start again, it will be back to the database error and I can repeat the process over and over.

I am afraid I don’t know what else might be locking these files :frowning:

Perhaps a particularly aggressive malware scanner or another 3rd party application? No matter what I tried I couldn’t reproduce this on my Windows machine.

If you can’t narrow this down further perhaps you might want to try running n8n using docker rather than npm?

Got released with [email protected]

@jan Hi, does 0.215 fix this issue?
I’ve used some older version (0.206, i guess) and i faced EBUSY sometimes on n8n start.
Recently i’ve updated to 0.210, and now i see it more often, even in the browser (i believe i haven’t seen that in previous version).
image

Yes that issue got fixed in newer versions. So you should definitely upgrade.

Oh yes, i’ve recently updated to 0.220 and i didnt see this issue anymore.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.