OpenEVSE / openevse_wifi_server

15 stars 11 forks source link

NPM Install issue on Stretch #2

Closed glynhudson closed 5 years ago

glynhudson commented 5 years ago

The NPM install worked fine on my Ubuntu desktop but I'm having issues install on a RasPi running Raspbien Stretch with nodejs V8.11.1:. Any ideas what's going wrong? Sorry, I'm not very familier with install NPM modules. I tried installing from NPM and running locally:

_modules/qs'
npm ERR! error rolling back  openevse_wifi@1.0.2 { Error: ENOTEMPTY:
directory not empty, rmdir
'/usr/local/lib/node_modules/openevse_wifi/node_modules/express/node_modules/qs'
npm ERR! error rolling back   errno: -39,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   syscall: 'rmdir',
npm ERR! error rolling back   path:
'/usr/local/lib/node_modules/openevse_wifi/node_modules/express/node_modules/qs'
}
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
npm ERR!     at /usr/share/npm/lib/cache/add-named.js:203:12
npm ERR!     at saved
(/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 4.14.71-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "openevse_wifi"
npm ERR! cwd /home/pi/openevse_wifi_server
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR! tar.unpack untar error /root/.npm/mqtt/2.18.8/package.tgz
npm ERR! tar.unpack untar error /root/.npm/iconv-lite/0.4.23/package.tgz
npm ERR! tar.unpack untar error /root/.npm/nock/10.0.6/package.tgz
npm ERR! tar.unpack untar error /root/.npm/media-typer/0.3.0/package.tgz
npm ERR! tar.unpack untar error /root/.npm/jquery/3.3.1/package.tgz
npm ERR! error rolling back Error: ENOTEMPTY: directory not empty,
rmdir '/usr/local/lib/node_modules/openevse_wifi/node_modules/express/node_modules/qs'
npm ERR! error rolling back  express@4.16.4 { Error: ENOTEMPTY:
directory not empty, rmdir
'/usr/local/lib/node_modules/openevse_wifi/node_modules/express/node_modules/qs'
npm ERR! error rolling back   errno: -39,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   syscall: 'rmdir',
npm ERR! error rolling back   path:
'/usr/local/lib/node_modules/openevse_wifi/node_modules/express/node_modules/qs'
}
npm ERR! tar.unpack untar error /root/.npm/mime-db/1.37.0/package.tgz
npm ERR! tar.unpack untar error /root/.npm/mime-types/2.1.21/package.tgz
npm ERR! tar.unpack untar error /root/.npm/inherits/2.0.3/package.tgz
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/openevse_wifi_server/npm-debug.log
npm ERR! not ok code 0
glynhudson commented 5 years ago

This could be due to Debian Stretch dropping support for NPM, the current version of NPM in the Stretch packages in version 1.4.21 which is very old. The current version on Ubuntu is 3.5.2

Here is an explanation for why npm support was dropped http://linuxbsdos.com/2017/06/26/how-to-install-node-js-lts-on-debian-9-stretch/

I will try to find a way to install newer version of npm on Stretch and will try the Docker version.

jeremypoulter commented 5 years ago

Yeah, just been trying it and that is the reason. That was a really old npm version. The instructions in the article look right for installing node, but would go for Node 10, so

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt install -y nodejs
glynhudson commented 5 years ago

Whoo! Got it to work with the following steps:

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt-get install -y nodejs
sudo chown -R pi ~/.config/ 
sudo chown -R pi ~/.npm
sudo chown -R pi /usr/lib/node_modules/
npm install -g openevse_wifi
openevse_wifi --endpoint /dev/ttyUSB0