Unable to install modules - permission denied

I have attempted to install two modules recently. node-red-contrib-sun-position, and node-red-dashboard. Both have failed due to the same error. Here is the output from my log file:

2022-11-18T00:50:37.753Z Install : node-red-dashboard 3.2.0

2022-11-18T00:50:38.072Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-dashboard@3.2.0
2022-11-18T00:50:44.200Z [err] npm
2022-11-18T00:50:44.200Z [err]  WARN locking Error: EACCES: permission denied, open '/data/.npm/_locks/staging-accc372ed0ccb0d8.lock'
2022-11-18T00:50:44.200Z [err] npm WARN locking  /data/.npm/_locks/staging-accc372ed0ccb0d8.lock failed [Error: EACCES: permission denied, open '/data/.npm/_locks/staging-accc372ed0ccb0d8.lock'] {
2022-11-18T00:50:44.200Z [err] npm WARN locking   errno: -13,
2022-11-18T00:50:44.200Z [err] npm WARN locking   code: 'EACCES',
2022-11-18T00:50:44.200Z [err] npm WARN locking   syscall: 'open',
2022-11-18T00:50:44.200Z [err] npm WARN locking   path: '/data/.npm/_locks/staging-accc372ed0ccb0d8.lock'
2022-11-18T00:50:44.200Z [err] npm WARN locking }
2022-11-18T00:50:44.264Z [err] npm ERR! code
2022-11-18T00:50:44.265Z [err]  EACCES
2022-11-18T00:50:44.265Z [err] npm ERR! syscall open
2022-11-18T00:50:44.265Z [err] npm ERR! path /data/.npm/_locks/staging-accc372ed0ccb0d8.lock
2022-11-18T00:50:44.265Z [err] npm ERR! errno
2022-11-18T00:50:44.265Z [err]  -13
2022-11-18T00:50:44.266Z [err] npm ERR! 
2022-11-18T00:50:44.266Z [err] npm
2022-11-18T00:50:44.266Z [err]  ERR! Your cache folder contains root-owned files, due to a bug in
2022-11-18T00:50:44.266Z [err] npm ERR! previous versions of npm which has since been addressed.
2022-11-18T00:50:44.266Z [err] npm 
2022-11-18T00:50:44.266Z [err] ERR! 
2022-11-18T00:50:44.266Z [err] npm ERR! To permanently fix this problem, please run:
2022-11-18T00:50:44.266Z [err] npm
2022-11-18T00:50:44.266Z [err]  ERR!   sudo chown -R 1000:1000 "/data/.npm"
2022-11-18T00:50:44.279Z [err] 
2022-11-18T00:50:44.279Z [err] npm ERR! A complete log of this run can be found in:
2022-11-18T00:50:44.279Z [err] npm ERR!     /data/.npm/_logs/2022-11-18T00_50_44_268Z-debug.log
2022-11-18T00:50:44.288Z rc=243

I have attempted to run the sudo chown -R 1000:1000 "/data/.npm" command recommended in the log file with no success. I attempted to run it from the Unraid NodeRed docker console, and got sh: sudo: not found. If I run it without sudo, I get chown: /data/.npm/_locks: Operation not permitted.

I am running Node-RED v2.0.0-beta.1 in a docker container on my Unraid server. I only use it to interface with a Home Assistant instance running in a separate VM. I have previously been able to install modules, but it's been a couple months since I last attempted to do so. Does anyone know how to fix this error?

Thanks

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