Error: Cannot find module '@abandonware/noble'


I am trying to run my customized node on Raspberry Pi 4 that runs DietPi OS. But, I am having errors along the way. I have tried many different things, but no success yet.

The main error that I would like to fix is the one in the title. However, as I am not sure what is the exact reason, I would like to include the errors I got along the way.

The following installation script does not work on DietPi:

bash <(curl -sL

So, I install node.js and node-red via using their recommended script (dietpi-software).

After installation finishes, I run npm doctor and got the following:

npm WARN checkFilesPermission error getting info for /usr/bin/node_modules
npm WARN checkFilesPermission error getting info for /usr/bin/node_modules/.bin
Check                               Value   Recommendation/Notes
npm ping                            ok
npm -v                              not ok  Use npm v8.1.0
node -v                             ok      current: v16.11.1, recommended: v16.11.1
npm config get registry             ok      using default registry (
which git                           ok      /usr/bin/git
Perms check on cached files         ok
Perms check on local node_modules   not ok  Check the permissions of files in /usr/bin/node_modules (should be owned by current user)
Perms check on global node_modules  ok
Perms check on local bin folder     not ok  Check the permissions of files in /usr/bin/node_modules/.bin
Perms check on global bin folder    ok
Verify cache contents               ok      verified 347 tarballs

npm ERR! Some problems found. See above for recommendations.

My customized package depends on @abandonware/noble. Hence, first, I install its dependencies:

sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev

Then, I install the @abandonware/noble package. This one should be done in /mnt/dietpi_userdata/node-red, otherwise will not work. So I run the following:
sudo npm i @abandonware/noble

If I do not install as root I get the following error:

Error: EACCES: permission denied, mkdir '/mnt/dietpi_userdata/node-red/node_modules/@abandonware'

Installation finishes without any error.

added 11 packages, and audited 306 packages in 47s

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

found 0 vulnerabilities

Then, I run Node-RED just to see if everything is fine:
dietpi-services start node-red.
I am actually running it as node-red-start as I am very used to it. To see how it is done please see the following discussion. Here is the Node-RED log that I believe it is pretty normal:

19 Oct 14:38:36 - [info] Node-RED version: v2.0.6
19 Oct 14:38:36 - [info] Node.js  version: v16.11.1
19 Oct 14:38:36 - [info] Linux 5.10.63-v8+ arm64 LE
19 Oct 14:38:37 - [info] Loading palette nodes
19 Oct 14:38:39 - [info] Settings file  : /mnt/dietpi_userdata/node-red/settings.js
19 Oct 14:38:39 - [info] Context store  : 'default' [module=memory]
19 Oct 14:38:39 - [info] User directory : /mnt/dietpi_userdata/node-red
19 Oct 14:38:39 - [warn] Projects disabled : editorTheme.projects.enabled=false
19 Oct 14:38:39 - [info] Flows file     : /mnt/dietpi_userdata/node-red/flows.json
19 Oct 14:38:39 - [info] Creating new flow file
19 Oct 14:38:40 - [warn]

Then, I stop Node-RED and install my customized package inside /mnt/dietpi_userdata/node-red.
sudo npm install /home/dietpi/node-red-contrib-ble-sense.

Then I run the Node-RED. But this time, I am getting an error:

19 Oct 15:50:00 - [warn] [node-red-contrib-ble-sense/protocols] Error: Cannot find module '@abandonware/noble'
Require stack:
- /home/dietpi/node-red-contrib-ble-sense/ble.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/registry/lib/loader.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/registry/lib/index.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/runtime/lib/index.js
- /mnt/dietpi_userdata/node-red/node_modules/node-red/lib/red.js
- /mnt/dietpi_userdata/node-red/node_modules/node-red/red.js

The thing that I believe it might be related to the problem.

  • The /mnt is owned by the root: drwxr-xr-x 6 root root 4096 Aug 12 15:16 mnt
  • I can see the @abandonware/noble package in package.json.
  "dependencies": {
    "@abandonware/noble": "^1.9.2-14",
    "node-red": "^2.0.6",
    "node-red-contrib-ble-sense": "file:../../../home/dietpi/node-red-contrib-ble-sense"
  • I can see the @abandonware/noble and node-red-contrib-ble-sense in /mnt/dietpi_userdata/node-red/node_modules.
  • Symbolic link is created for node-red-contrib-ble-sense and owned by the root.
    lrwxrwxrwx 1 root root 50 Oct 19 15:47 node-red-contrib-ble-sense -> ../../../../home/dietpi/node-red-contrib-ble-sense. I realized all other packages are owned by nodered and belong to the group nodered.
  • The /home/dietpi/node-red-contrib-ble-sense is owned by dietpi and belong to the dietpi group
  • dietpi is only included in dietpi group.

I developed that package via the Raspberry Pi OS without any issues. I would like to continue the development in DietPi for other reasons. I appreciate any feedback.

Your problem is clearly highlighted here. You have mixed up permissions and so will now be suffering.

You should not be installing npm modules with sudo generally.

I tried installing via nvm as it is recommended in many places, still no luck.

Apparently I was running npm doctor from a wrong path. Now npm doctor generated all OKs.

However npm install asked for permissions again.

Then I followed the instructions mentioned here.

Now, I can install nodes without root permission. I will test developing customized node now.

Honestly, it is best to steer away from node version managers, they tend to cause more issues than they resolve.

You will need to sort out the permissions in the folders because those may already be messed up.

Hi @TotallyInformation,

I did the fresh install, then applied the fix that I gave a link in my above post. Now I can install nodes without root permission.

1 Like

As always, the rule is - don't use sudo unless you really need to.

1 Like

I am still getting the error of Error: Cannot find module ā€˜@abandonware/nobleā€™ when I install my custom node and run Node-RED. However, I have a new lead, I am getting this warning now:

(node:12996) [DEP0128] DeprecationWarning: Invalid 'main' field in '/mnt/dietpi_userdata/node-red/node_modules/@node-red/editor-client/package.json' of './lib/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)

If I check that field, it is

    "name": "@node-red/editor-client",
    "version": "2.0.6",
    "license": "Apache-2.0",
    "repository": {
        "type": "git",
        "url": ""
    "contributors": [
            "name": "Nick O'Leary"
            "name": "Dave Conway-Jones"
    "main": "./lib/index.js"

Maybe @knolleary can help with this.
Also, here is log of my main error, that I am trying to solve:

[warn] [node-red-contrib-ble-sense/protocols] Error: Cannot find module '@abandonware/noble'
Require stack:
- /home/dietpi/node-red-contrib-ble-sense/ble.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/registry/lib/loader.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/registry/lib/index.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /mnt/dietpi_userdata/node-red/node_modules/@node-red/runtime/lib/index.js
- /mnt/dietpi_userdata/node-red/node_modules/node-red/lib/red.js
- /mnt/dietpi_userdata/node-red/node_modules/node-red/red.js

Another lead that I have is, I have realized ~/.npm is empty, but ~/.npm-global has the modules.

That is just a warning when running with Node 16. It has been fixed in 2.1 but has absolutely no bearing on the issue you're experiencing.

Alright. I am running Node-RED 17.0.0 though.

The deprecation warning was introduced in Node 16.... so Node 17 has it as well.

Oh, alright. Node-RED version: v2.1.0 I am not getting that anymore as expected.

Now, the issue is the following:

[node-red-contrib-ble-sense/protocols] Error: EAFNOSUPPORT, Address family not supported by protocol

I have understood the reason. Now digging more to resolve this, sadly all examples I found are related to dockers.

I was getting an error as I forgot to enable the bluetooth :expressionless:. Now all works fine, I can finally start developing my package further :cowboy_hat_face:.

TL:DR for how to develop your own node that depends on @abandonware/noble in DietPi.

  • Install node.js, node-red, and git via dietpi-software.
  • cd into /mnt/dietpi_userdata/node-red
  • Run sudo -u nodered npm doctor. Get all OKs.
  • Enable bluetooth via dietpi-config.
  • Reboot.
  • cd into /mnt/dietpi_userdata/node-red and install @abandonware/noble: sudo -u nodered npm i @abandonware/noble.
  • Put your customized node folder in the same location as well.
  • Then install your customized package sudo -u nodered npm i /mnt/dietpi_userdata/node-red/mypackage.
  • Run node-red: systemctl start node-red.
    Now you should be able to see your custom node as well.

Update: We also need to grant some privileges to node to do BLE/Bluetooth scan.

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

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