How to fix n8n docker: Error: EACCES: permission denied, open '/home/node/.n8n/config'
Problem
While starting n8n in a Docker container, you encounter the following error message:
example.txt
Error: EACCES: permission denied, open '/home/node/.n8n/config'
at writeFileSync (node:fs:2425:20)
at InstanceSettings.save (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/instance-settings/instance-settings.ts:241:16)
at InstanceSettings.loadOrCreate (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/instance-settings/instance-settings.ts:218:8)
at new InstanceSettings (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/instance-settings/instance-settings.ts:67:24)
at ContainerClass.get (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+di@file+packages+@n8n+di/node_modules/@n8n/di/src/di.ts:104:16)
at CommunityPackagesModule.loadDir (/usr/local/lib/node_modules/n8n/src/modules/community-packages/community-packages.module.ts:37:30)
at ModuleRegistry.loadModules (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+backend-common@file+packages+@n8n+backend-common/node_modules/@n8n/backend-common/src/modules/module-registry.ts:99:20)
at CommandRegistry.execute (/usr/local/lib/node_modules/n8n/src/command-registry.ts:46:3)
at /usr/local/lib/node_modules/n8n/bin/n8n:63:2Solution
You need to adjust the permissions of the /home/node/.n8n directory to ensure that the node user inside the Docker container has the necessary access rights.
Likely, you’ve mapped it to a directory on your host machine that does not have the correct permissions, such as n8n_storage.
You can fix this issue by running the following command on your host machine:
example.sh
chown -R 1000:1000 n8n_storageReplace the directory by the exact directory in use.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow