Closed jbaarends closed 5 years ago
How did you install the server to begin with?
I like to think so (see code below). But, I'm a huge noob and still learning basics, so it could be that I'm mistaken...
` root@NASDS216:~# sudo npm i nefit-easy-http-server -g npm WARN deprecated node-xmpp-client@3.2.0: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js /volume2/@appstore/Node.js_v8/usr/local/bin/easy-server -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server
Error: Cannot find module 'node-xmpp-core'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.
It works for me on my Synology, so it's not specifically related to that.
I've had issues like this before (in a completely different environment) caused by a file called package-lock.json
being present in the directory from which you start npm
. Try and see if this works:
cd ~
rm package-lock.json
npm i nefit-easy-http-server -g
No luck :-( Could it have something to do with my appstore being located on volume 2 (in most tutorials I see them located on volume1)?
`root@NASDS216:~# cd ~ root@NASDS216:~# rm package-lock.json root@NASDS216:~# npm i nefit-easy-http-server -g npm WARN deprecated node-xmpp-client@3.2.0: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js /volume2/@appstore/Node.js_v8/usr/local/bin/easy-server -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server
Error: Cannot find module 'node-xmpp-core'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.
The volume shouldn't be a problem.
Try doing a local install to see if that will work:
cd /tmp
npm i nefit-easy-http-server
./node_modules/.bin/easy-server -h
If that works, it's something related to the global package directory. If you don't have any other Node.js modules/projects installed, perhaps you could try uninstalling the Node.js package, removing /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules
, and re-installing the package again.
I've removed the node.jsV8 package via Package Center, and checked whether there was anything left in the /volume2/@appstore/. There wasn't. So that's good. Now, I reinstalled Node.jsV8 via package center. Then I ran sudo npm i nefit-easy-http-server -g
. That went oke. Then I tried easy-server -v
, and it says: 'No such file or directory'. I look into the folder /usr/local/bin and there I see easy-server. However, when I try to start it, it says it doesn't exist. Any ideas?
`root@NASDS216:~# node -v -ash: /usr/local/bin/node: No such file or directory root@NASDS216:~# npm -v -ash: /usr/local/bin/npm: No such file or directory root@NASDS216:~# cd /volume2/@appstore/ root@NASDS216:/volume2/@appstore# dir total 48 drwxr-xr-x 11 root root 4096 Aug 6 10:53 . drwxr-xr-x 16 root root 4096 Aug 5 22:35 .. drwxr-xr-x 15 AudioStation AudioStation 4096 May 23 19:48 AudioStation drwxr-xr-x+ 12 100 root 4096 Aug 4 22:51 domoticz drwxr-xr-x 5 root root 4096 Jul 26 09:47 Java8 drwxr-xr-x 4 root root 4096 Aug 6 10:53 Node.js_v8 drwxr-xr-x 7 root root 4096 Jun 4 05:09 PHP5.6 drwxr-xr-x 7 root root 4096 Jan 15 2019 PHP7.0 drwxr-xr-x 5 root root 4096 Jul 30 23:22 PHP7.2 drwxr-xr-x 16 VideoStation VideoStation 4096 Jun 22 08:01 VideoStation drwxr-xr-x 14 root root 4096 Jul 30 15:11 WebStation root@NASDS216:/volume2/@appstore# cd root@NASDS216:~# sudo npm i nefit-easy-http-server -g npm WARN deprecated node-xmpp-client@3.2.0: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js /volume2/@appstore/Node.js_v8/usr/local/bin/easy-server -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server
The local install worked, I guess: `root@NASDS216:/tmp# ./node_modules/.bin/easy-server -h easy-server – Nefit Easy™ HTTP-server
Usage: easy-server [options]
Options: -h --help Show this screen -v --version Show version -V --verbose Be more verbose --serial=SERIAL Nefit Easy™ serial number --access-key=ACCESS_KEY Nefit Easy™ access key --password=PASSWORD Nefit Easy™ password --port=PORT Port to listen on [default: 3000] --host=HOST Host to bind to [default: 127.0.0.1] --timeout=TIMEOUT Request timeout in seconds [default: 30]
Instead of specifying serial number, access key or password through options, you can also define them through environment variables:
NEFIT_SERIAL_NUMBER NEFIT_ACCESS_KEY NEFIT_PASSWORD `
By the way: huge thanks for taking the time looking into this. Really appreciated! :-)
Try this:
/usr/local/bin/easy-server
(without the cd
, which means "change directory")
Perhaps you need to re-start your login session (I assume through SSH) for it to be picked up.
Started a new session:
root@NASDS216:~# /usr/local/bin/easy-server -ash: /usr/local/bin/easy-server: No such file or directory root@NASDS216:~# easy-server -ash: easy-server: command not found root@NASDS216:~# ^C root@NASDS216:~# cd /usr/local/bin root@NASDS216:/usr/local/bin# dir total 20 drwxr-xr-x 3 root root 4096 Aug 6 10:53 . drwxr-xr-x 9 root root 4096 Aug 6 10:53 .. lrwxrwxrwx 1 root root 58 Aug 4 15:00 easy-server -> ../lib/node_modules/nefit-easy-http-server/bin/easy-server drwxr-xr-x 5 root root 4096 Mar 27 2017 feasibilitycheck lrwxrwxrwx 1 root root 48 Aug 6 10:53 node -> /volume2/@appstore/Node.js_v8/usr/local/bin/node lrwxrwxrwx 1 root root 46 Aug 6 10:53 npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js -rwxr-xr-x 1 root root 7968 Aug 6 10:53 nvm lrwxrwxrwx 1 root root 47 Aug 5 19:38 php56 -> /var/packages/PHP5.6/target/usr/local/bin/php56 lrwxrwxrwx 1 root root 51 Aug 5 19:38 php56-cgi -> /var/packages/PHP5.6/target/usr/local/bin/php56-cgi lrwxrwxrwx 1 root root 51 Aug 5 19:38 php56-fpm -> /var/packages/PHP5.6/target/usr/local/bin/php56-fpm lrwxrwxrwx 1 root root 47 Aug 5 19:38 php70 -> /var/packages/PHP7.0/target/usr/local/bin/php70 lrwxrwxrwx 1 root root 51 Aug 5 19:38 php70-cgi -> /var/packages/PHP7.0/target/usr/local/bin/php70-cgi lrwxrwxrwx 1 root root 51 Aug 5 19:38 php70-fpm -> /var/packages/PHP7.0/target/usr/local/bin/php70-fpm lrwxrwxrwx 1 root root 47 Aug 5 19:38 php72 -> /var/packages/PHP7.2/target/usr/local/bin/php72 lrwxrwxrwx 1 root root 51 Aug 5 19:38 php72-cgi -> /var/packages/PHP7.2/target/usr/local/bin/php72-cgi lrwxrwxrwx 1 root root 51 Aug 5 19:38 php72-fpm -> /var/packages/PHP7.2/target/usr/local/bin/php72-fpm lrwxrwxrwx 1 root root 50 Aug 5 19:38 phpdbg56 -> /var/packages/PHP5.6/target/usr/local/bin/phpdbg56 lrwxrwxrwx 1 root root 50 Aug 5 19:38 phpdbg70 -> /var/packages/PHP7.0/target/usr/local/bin/phpdbg70 lrwxrwxrwx 1 root root 50 Aug 5 19:38 phpdbg72 -> /var/packages/PHP7.2/target/usr/local/bin/phpdbg72 root@NASDS216:/usr/local/bin#
This means that easy-server is in the right place right? However it won't start for some reason?
What does this output?
env node -h
root@NASDS216:~# env node -h Usage: node [options] [ -e script | script.js | - ] [arguments] node inspect script.js [arguments]
Options: -v, --version print Node.js version -e, --eval script evaluate script -p, --print evaluate script and print result -c, --check syntax check script without executing -i, --interactive always enter the REPL even if stdin does not appear to be a terminal -r, --require module to preload (option can be repeated)
Environment variables: NODE_DEBUG ','-separated list of core modules that should print debug information NODE_DISABLE_COLORS set to 1 to disable colors in the REPL NODE_EXTRA_CA_CERTS path to additional CA certificates file NODE_ICU_DATA data path for ICU (Intl object) data NODE_NO_WARNINGS set to 1 to silence process warnings NODE_NO_HTTP2 set to 1 to suppress the http2 module NODE_OPTIONS set CLI options in the environment via a space-separated list NODE_PATH ':'-separated list of directories prefixed to the module search path NODE_PENDING_DEPRECATION set to 1 to emit pending deprecation warnings NODE_REPL_HISTORY path to the persistent REPL history file NODE_REDIRECT_WARNINGS write warnings to path instead of stderr OPENSSL_CONF load OpenSSL configuration from file
Documentation can be found at https://nodejs.org/ root@NASDS216:~#
Okay, so that works. Next to try:
env node /usr/local/bin/easy-server -h
That gives:
root@NASDS216:~# env node /usr/local/bin/easy-server -h module.js:540 throw err; ^
Error: Cannot find module '/usr/local/bin/easy-server' at Function.Module._resolveFilename (module.js:538:15) at Function.Module._load (module.js:468:25) at Function.Module.runMain (module.js:684:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 root@NASDS216:~#
Hmm, that would mean that the symlink in /usr/local/bin
is broken. What does this return:
ls -al /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server
This gives:
root@NASDS216:~# ls -al /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server -rwxr-xr-x 1 root root 46 Aug 6 10:54 /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server root@NASDS216:~#
Next try:
env node /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server -h
We are getting somewhere! This gives:
`root@NASDS216:~# env node /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server -h easy-server – Nefit Easy™ HTTP-server
Usage: easy-server [options]
Options: -h --help Show this screen -v --version Show version -V --verbose Be more verbose --serial=SERIAL Nefit Easy™ serial number --access-key=ACCESS_KEY Nefit Easy™ access key --password=PASSWORD Nefit Easy™ password --port=PORT Port to listen on [default: 3000] --host=HOST Host to bind to [default: 127.0.0.1] --timeout=TIMEOUT Request timeout in seconds [default: 30]
Instead of specifying serial number, access key or password through options, you can also define them through environment variables:
NEFIT_SERIAL_NUMBER NEFIT_ACCESS_KEY NEFIT_PASSWORD
root@NASDS216:~#`
Okay, we're close! I still don't understand why the version installed in /usr/local/bin
doesn't work, but perhaps it's a dangling symlink so we can try to fix it:
cd /usr/local/bin
rm easy-server
ln -s /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server easy-server
YES!! Thank you so much! It works, immediately in Domoticz as well. You are the best! Thank you for your generosity in putting the time and effort in my setup!
Good to hear you got it working! Have fun using it :D
i try to run nefit easy on my synology but ik wont work, get this message
root@NAS_play:~# npm i nefit-easy-http-server -g npm WARN deprecated node-xmpp-client@3.2.0: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js /volume1/@appstore/Node.js_v8/usr/local/bin/easy-server -> /volume1/@appstore/Node.js_v8/usr/local/lib/node_modules/nefit-easy-http-server/bin/easy-server
can you help me?
You need to add /volume1/@appstore/Node.js_v8/usr/local/bin/
to your $PATH
, or otherwise start the server using it's full path:
/volume1/@appstore/Node.js_v8/usr/local/bin/easy-server --serial=********* --access-key=******** --password=*****
it works thanks, now i wil look for a autostart for the server.
I've installed easy-server, but something keeps preventing it from running. I use a synology nas. Here are the outputs I get: ` root@NASDS216:/# node -v v8.9.4 root@NASDS216:/# npm -v 5.6.0 root@NASDS216:/# easy-server module.js:540 throw err; ^
Error: Cannot find module 'node-xmpp-core' at Function.Module._resolveFilename (module.js:538:15) at Function.Module._load (module.js:468:25) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object. (/usr/local/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-commands/node_modules/nefit-easy-core/lib/scram-auth-mechanism.js:4:19)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-commands/node_modules/nefit-easy-core/lib/index.js:10:20)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
`
Consequently, Domoticz keeps reporting it cannot get any data. Well, that's unfortunate, but first I need to get easy-server running. Any ideas? I'm a huge noob, so if you can provide me with the specific codes I need to insert into putty, than that would be super helpfull.