Hi,
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 https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
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 (https://registry.npmjs.org/)
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
andnode-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 bynodered
and belong to the groupnodered
. - The
/home/dietpi/node-red-contrib-ble-sense
is owned bydietpi
and belong to thedietpi
group -
dietpi
is only included indietpi
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.