Sudo command not found

Hi all,
I am running windows 11 with Docker Desktop. After start the Node-red container, I accessed to Node-red through command: "docker exec -it mynodered bash". From here, I tried to run command: "npm install -g n" and got error: permission denied, access '/usr/local/lib/node_modules'. Check ID uid=1000(node-red) gid=20(dialout). I have also attempted to run "sudo chown -R $(whoami) /usr/local/lib/node_modules" but got the error sudo command not found.

Docker containers are locked down by design. There are multiple docker tags for different versions of node.js with Node Red (eg. latest-12, latest-14, latest-16). What is it you're trying to achieve?

Hi Michael,
I want to upgrade Nodejs and NPM to latest version.

2022-04-20T21:49:02.318Z [err] npm ERR! notsup Required: {"node":">=12.13.0 <13.0.0"}
2022-04-20T21:49:02.318Z [err] npm ERR! notsup Actual: {"npm":"6.14.15","node":"14.18.2"}

You do that by running a different image in the container. The error you're getting is probably coming from one of the nodes you have installed, expecting a specific version of node.js. You would be better off by looking in the NR Palette to see if any nodes can be updated, rather than it forcing you into a particular version of node.js. If that doesn't work, the 'latest-12' tag would give you what you need - change the image you're currently running the container to

nodered/node-red:latest-12

Hi Michael,
I tried latest-12 also failed to install the palette (node-red-contrib-accellion (node) - Node-RED)

> 21 Apr 03:35:44 - [info] Installing module: node-red-contrib-accellion, version: 0.1.21
21 Apr 03:38:29 - [warn] Installation of module node-red-contrib-accellion failed:
21 Apr 03:38:29 - [warn] ------------------------------------------
21 Apr 03:38:29 - [warn] npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated node-pre-gyp@0.12.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: 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 bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated superagent@3.8.3: Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-x64-musl.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@12.22.8 (node-v72 ABI, musl) (falling back to source compile with node-gyp)
In file included from ../src/bcrypt_node.cc:1:
../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
 2232 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
      |                                                              ^
In file included from ../node_modules/nan/nan.h:53,
                 from ../src/bcrypt_node.cc:1:
../src/bcrypt_node.cc: At global scope:
/usr/src/node-red/.cache/node-gyp/12.22.8/include/node/node.h:736:43: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
  736 |       (node::addon_register_func) (regfunc),                          \
      |                                           ^
/usr/src/node-red/.cache/node-gyp/12.22.8/include/node/node.h:770:3: note: in expansion of macro 'NODE_MODULE_X'
  770 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/bcrypt_node.cc:378:1: note: in expansion of macro 'NODE_MODULE'
  378 | NODE_MODULE(bcrypt_lib, init);
      | ^~~~~~~~~~~
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v72-linux-x64-musl.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.8 and node@12.22.8 (node-v72 ABI, musl) (falling back to source compile with node-gyp)
In file included from ../src/bcrypt_node.cc:1:
../../nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../../nan/nan.h:2298:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
 2298 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
      |                                                              ^
In file included from ../../nan/nan.h:54,
                 from ../src/bcrypt_node.cc:1:
../src/bcrypt_node.cc: At global scope:
/usr/src/node-red/.cache/node-gyp/12.22.8/include/node/node.h:736:43: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
  736 |       (node::addon_register_func) (regfunc),                          \
      |                                           ^
/usr/src/node-red/.cache/node-gyp/12.22.8/include/node/node.h:770:3: note: in expansion of macro 'NODE_MODULE_X'
  770 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/bcrypt_node.cc:359:1: note: in expansion of macro 'NODE_MODULE'
  359 | NODE_MODULE(bcrypt_lib, init);
      | ^~~~~~~~~~~
prebuild-install WARN install No prebuilt binaries found (target=12.22.8 runtime=node arch=x64 libc=musl platform=linux)
/bin/sh: pkg-config: not found
gyp: Call to 'pkg-config --libs-only-l libsecret-1' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/node_modules/keytar
gyp ERR! node -v v12.22.8
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keytar@5.6.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keytar@5.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/.npm/_logs/2022-04-21T03_38_29_304Z-debug.log

21 Apr 03:38:29 - [warn] ------------------------------------------
Error: Install failed
    at /usr/src/node-red/node_modules/@node-red/registry/lib/installer.js:285:25
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
21 Apr 03:38:29 - [error] Error: Install failed

Containers (incl docker) should be considered to be immutable.
Never, ever install anything into them directly. Instead use the -v mount options to bind your local filesystem or docker volume to the container.

See the documentation for an example. ( "Using a Host Directory for Persistence (Bind Mount)")

Once you have set this up, use the node-red UI directly, hamburger menu in the right top > manage palette > install tab, search the node > install.

Hi Bak,
I tried to install directly using Palette from Node-Red setting but received some errors like this:

I could not install it through the palette (different errors though), and had to do so manually and restart NR to pick up. Then it required node v14.16.0, so I'm not sure why there's a discrepancy. Regardless, then I got the same result as you. Googling err_dlopen_failed didn't help much, but I gave up after the first screenful.

I think you would have to try going back to the developers of the node, although they have not provided a github link.