Skip to content

Instantly share code, notes, and snippets.

@erossignon
Created August 10, 2020 20:16
Show Gist options
  • Save erossignon/f916326e9ee51374f42bfa2e317ce38f to your computer and use it in GitHub Desktop.
Save erossignon/f916326e9ee51374f42bfa2e317ce38f to your computer and use it in GitHub Desktop.
$ ssh pi@raspberrypi
pi@raspberrypi's password:
Linux raspberrypi 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Aug 10 18:37:26 2020
Linux raspberrypi 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Aug 10 18:37:26 2020
pi@raspberrypi:~ $ sudo -s
root@raspberrypi:/home/pi# cd .node-red/
root@raspberrypi:/home/pi/.node-red# ls -al
total 256
drwxr-xr-x 4 pi pi 4096 août 9 19:55 .
drwxr-xr-x 21 pi pi 4096 août 9 18:23 ..
-rw-r--r-- 1 pi pi 19888 août 9 19:55 .config.json
-rw-r--r-- 1 pi pi 19890 août 7 20:44 .config.json.backup
-rw-r--r-- 1 pi pi 100 août 7 17:37 flows_raspberrypi_cred.json
-rw-r--r-- 1 pi pi 72 août 7 17:33 .flows_raspberrypi_cred.json.backup
-rw-r--r-- 1 pi pi 4165 août 7 21:05 flows_raspberrypi.json
-rw-r--r-- 1 pi pi 3925 août 7 21:03 .flows_raspberrypi.json.backup
drwxr-xr-x 3 pi pi 4096 août 7 17:26 lib
drwxr-xr-x 321 pi pi 12288 août 7 20:44 node_modules
-rw-r--r-- 1 pi pi 235 août 7 20:44 package.json
-rw-r--r-- 1 pi pi 154967 août 7 20:44 package-lock.json
-rw-r--r-- 1 pi pi 12610 août 7 17:26 settings.js
root@raspberrypi:/home/pi/.node-red# whoami
root
root@raspberrypi:/home/pi/.node-red# npm install --unsafe-perm node-red-contrib-opcua
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
o..................] | loadIdealTree:loadAllDepsIntoIdealTree: sill install loadIdealTree
[..................] / fetchMetadata: sill removeObsoleteDep removing treeify@1.1.0 from the tree as its been replaced by a new
> node-opcua-client@2.9.1 postinstall /home/pi/.node-red/node_modules/node-opcua-client
> node test_helpers/create_certificates.js certificate -s -o certificates/client_selfsigned_cert_2048.pem
Creating default g_config file /home/pi/.node-red/node_modules/node-opcua-client/certificates/config.js
> node-opcua-server@2.9.1 postinstall /home/pi/.node-red/node_modules/node-opcua-server
> node test_helpers/create_certificates.js certificate -s -o certificates/server_selfsigned_cert_2048.pem
Creating default g_config file /home/pi/.node-red/node_modules/node-opcua-server/certificates/config.js
> node-opcua-server-discovery@2.9.1 postinstall /home/pi/.node-red/node_modules/node-opcua-server-discovery
> npm run certificate
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
> node-opcua-server-discovery@2.9.1 certificate /home/pi/.node-red/node_modules/node-opcua-server-discovery
> node test_helpers/create_certificates.js certificate -s -o certificates/server_selfsigned_cert_2048.pem
Creating default g_config file /home/pi/.node-red/node_modules/node-opcua-server-discovery/certificates/config.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN ws@7.3.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.3.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
+ node-red-contrib-opcua@0.2.77
added 71 packages from 25 contributors, removed 1 package and updated 13 packages in 630.637s
root@raspberrypi:/home/pi/.node-red#
@erossignon
Copy link
Author

However after this

rroot@raspberrypi:/home/pi/.node-red# ls -al node_modules/
total 1532
drwxr-xr-x 380 pi   pi   16384 août  10 20:09 .
drwxr-xr-x   4 pi   pi    4096 août  10 20:09 ..
drwxr-xr-x   2 pi   pi    4096 août   7 20:44 accepts
drwxr-xr-x   3 pi   pi    4096 août   7 20:44 after
drwxr-xr-x   2 pi   pi    4096 août   7 17:30 aggregate-error
drwxr-xr-x   3 root root  4096 août  10 20:09 ansi-align
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 ansi-regex
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 ansi-styles
drwxr-xr-x   2 pi   pi    4096 août   7 17:30 anymatch
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 any-promise
drwxr-xr-x   3 pi   pi    4096 août   7 20:44 arraybuffer.slice
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 array-flatten
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 array-union
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 asn1
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 assert-plus
drwxr-xr-x   4 pi   pi    4096 août   7 17:29 async
drwxr-xr-x   2 pi   pi    4096 août   7 20:44 async-limiter
drwxr-xr-x   3 pi   pi    4096 août   7 20:44 backo2
drwxr-xr-x   4 pi   pi    4096 août   7 17:30 backoff
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 balanced-match
drwxr-xr-x   3 pi   pi    4096 août   7 20:44 base64-arraybuffer
drwxr-xr-x   3 pi   pi    4096 août   7 20:44 base64id
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 bcrypt-pbkdf
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 better-assert
drwxr-xr-x   2 pi   pi    4096 août  10 20:09 .bin
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 binary-extensions
drwxr-xr-x   4 pi   pi    4096 août   7 20:44 blob
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 bomstrip
drwxr-xr-x   4 pi   pi    4096 août   7 17:29 bonjour
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 boolbase
drwxr-xr-x   3 root root  4096 août  10 20:09 boxen
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 brace-expansion
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 braces
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 browser-process-hrtime
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 buffer-crc32
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 buffer-indexof
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 byline
drwxr-xr-x   2 pi   pi    4096 août   7 20:44 bytes
drwxr-xr-x   4 root root  4096 août  10 20:09 cacheable-request
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 callbackify
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 callsite
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 camelcase
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 chalk
drwxr-xr-x   4 pi   pi    4096 août   7 17:29 chokidar
drwxr-xr-x   2 root root  4096 août  10 20:09 ci-info
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 clean-stack
drwxr-xr-x   2 root root  4096 août  10 20:09 cli-boxes
drwxr-xr-x   4 pi   pi    4096 août   7 17:29 cli-spinner
drwxr-xr-x   4 pi   pi    4096 août   7 17:29 cli-table
drwxr-xr-x   3 pi   pi    4096 août   7 17:29 cliui
drwxr-xr-x   3 root root  4096 août  10 20:09 clone-response
drwxr-xr-x   2 pi   pi    4096 août   7 17:29 color-convert
```

@erossignon
Copy link
Author

so it is not a good idea to do npm installin sudo mode.

@erossignon
Copy link
Author

Doing

pi@raspberrypi:~/.node-red $ npm i
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

Btw, npm seems out of date, let fix it

npm install -g npm

@erossignon
Copy link
Author

Argh !!!

pi@raspberrypi:~/.node-red $ npm install -g npm
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN checkPermissions Missing write access to /usr/local/lib
npm ERR! path /usr/local/lib
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-08-10T20_20_25_208Z-debug.log

@erossignon
Copy link
Author

try again

sudo npm install -g npm

arg !!!

pi@raspberrypi:~/.node-red $ npm install -g npm  --unsave-perm                                    
npm WARN npm npm does not support Node.js v10.21.0                                                
npm WARN npm You should probably upgrade to a newer version of node as we                         
npm WARN npm can't make any promises that npm will work with this version.                        
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.               
npm WARN npm You can find the latest version at https://nodejs.org/                               
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm                 
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules                     
npm ERR! path /usr/local/lib/node_modules/npm                                                     
npm ERR! code EACCES                                                                              
npm ERR! errno -13                                                                                
npm ERR! syscall access                                                                           
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'               
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm']          
npm ERR!   stack:                                                                                 
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm\'',       
npm ERR!   errno: -13,                                                                            
npm ERR!   code: 'EACCES',                                                                        
npm ERR!   syscall: 'access',                                                                     
npm ERR!   path: '/usr/local/lib/node_modules/npm' }                                              
npm ERR!                                                                                          
npm ERR! The operation was rejected by your operating system.                                     
npm ERR! It is likely you do not have the permissions to access this file as the current user     
npm ERR!                                                                                          
npm ERR! If you believe this might be a permissions issue, please double-check the                
npm ERR! permissions of the file and its containing directories, or try running                   
npm ERR! the command again as root/Administrator (though this is not recommended).                
                                                                                                  
npm ERR! A complete log of this run can be found in:                                              
npm ERR!     /home/pi/.npm/_logs/2020-08-10T20_23_16_876Z-debug.log                               
pi@raspberrypi:~/.node-red $ sudo chmod -R a+rw /usr/local/lib/node_modules/npm                   
sudo chmod -R a+rw /usr/local/lib/node_modules
sudo chmod -R a+rw /usr/local/lib/node_modules/npm
sudo chmod -R a+rw /usr/local/bin
npm install -g npm 

Hourra !


npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment