qistoph / MMM-nstreinen

MagicMirror² module to show Dutch train information
12 stars 4 forks source link

npm install results in errors #24

Closed RaspNewby closed 4 years ago

RaspNewby commented 4 years ago

Hi, I am quite new to this, so forgive me for saying stupid stuff. I tried to follow the instructions to add the nstreinen module, but I ran into some issues. npm install resulted in several errors. I added a screenshot of these errors. The module is stuck at loading in my magicmirror. Here is the module in my config file: { module: 'nstreinen', position: 'top_right', header: 'Treinen vanaf Schiphol Airport', config: { apiKey:'xxx', fromStation: 'SHL' } }, Here are the versions I use: magicmirror v2 npm version 6.13.4 nodejs version 10.18.0 Raspbian GNU/Linux 10

Additionally, I used the primary key of the "Public-Travel-Information" for the API-key in the config file (xxx). Is that the correct way? Errors

If I need to provide additional info, please let me know.

enzobronzwaer commented 4 years ago

Hi, I've got the same warmings/erros.

@qistoph Are you familiar with this issue?

qistoph commented 4 years ago

Doesn't look familiar. Could you share the exact steps you've taken to install the module?

RaspNewby commented 4 years ago

These are the steps I followed:

Installing git clone https://github.com/qistoph/MMM-nstreinen.git nstreinen - Check cd nstreinen - Check npm install to install the dependencies - Errors as described

Updating the module git pull - Check npm install to update the dependencies - Errors as described

Editing config file Lastly, I added the standard code to the config file and I used the primary key of the "Public-Travel-Information" for the API-key

shibmaster commented 4 years ago

Doesn't look familiar. Could you share the exact steps you've taken to install the module?

I also run into similar errors, the steps are exactly as described in the readme:

pi@raspberrypi:~/MagicMirror/modules $ git clone https://github.com/qistoph/MMM-nstreinen.git nstreinen Klone nach 'nstreinen' ... remote: Enumerating objects: 282, done. remote: Total 282 (delta 0), reused 0 (delta 0), pack-reused 282 Empfange Objekte: 100% (282/282), 209.17 KiB | 0 bytes/s, Fertig. Löse Unterschiede auf: 100% (182/182), Fertig. pi@raspberrypi:~/MagicMirror/modules $ cd nstreinen pi@raspberrypi:~/MagicMirror/modules/nstreinen $ npm install npm WARN deprecated time-grunt@2.0.0: Deprecated because Grunt is practically unmaintained. Move on to something better. This package will continue to work with Grunt v1, but it will not receive any updates. npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/define-property-6763baf0/package.json' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/figures-bae1765e/package.json' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/object-assign-2317dfeb/package.json' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/is-finite-f3ed8f17/package.json' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/num2fraction-48af3b87/package.json' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/number-is-nan-97825d55/package.json' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/define-property-6763baf0/README.md' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/figures-bae1765e/index.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/object-assign-2317dfeb/index.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/is-finite-f3ed8f17/index.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/num2fraction-48af3b87/.npmignore' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/number-is-nan-97825d55/index.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/define-property-6763baf0/LICENSE' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/figures-bae1765e/license' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/object-assign-2317dfeb/license' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/is-finite-f3ed8f17/license' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/num2fraction-48af3b87/README.md' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/number-is-nan-97825d55/license' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/define-property-6763baf0/index.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/figures-bae1765e/readme.md' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/object-assign-2317dfeb/readme.md' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/is-finite-f3ed8f17/readme.md' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/num2fraction-48af3b87/LICENSE' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/number-is-nan-97825d55/readme.md' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/num2fraction-48af3b87/index.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/num2fraction-48af3b87/.editorconfig' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/source-map-a6c2a924/dist/source-map.min.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/source-map-a6c2a924/dist/source-map.min.js.map' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/regexpp-f6569eb8/index.mjs' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/parseSelector.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/rawNodeString.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/removeEmptyLinesAfter.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/removeEmptyLinesBefore.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/report.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/ruleMessages.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/validateObjectWithArrayProps.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/validateObjectWithStringArrayProps.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/validateObjectWithStringOrRegexArrayProps.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/validateOptions.js' npm WARN tar ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/utils/whitespaceChecker.js' npm WARN tar ENOENT: no such file or directory, lstat '/home/pi/MagicMirror/modules/nstreinen/node_modules/.staging/stylelint-8dd213ef/lib/vendor' npm ERR! code 1 npm ERR! Command failed: git checkout v3 npm ERR! error: pathspec 'v3' did not match any file(s) known to git. npm ERR!

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

FULL DEBUG LOG: https://pastebin.com/mdh7R2nH

Thank you for your concern! If you need anything else, let us know!

MadhunterNL commented 4 years ago

Having exact the same problems as described. Exactly followed the steps to install as described

qistoph commented 4 years ago

Could you try removing the "#v3" from the ns-api in package.json and retry?

diff --git a/package.json b/package.json
index ad6bf19..3cf8ed0 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,7 @@
   "dependencies": {
     "eslint": "^5.16.0",
     "node-rest-client": "^3.1.0",
-    "ns-api": "git+https://github.com/fvdm/nodejs-ns-api.git#v3"
+    "ns-api": "git+https://github.com/fvdm/nodejs-ns-api.git"
   },
   "bugs": {
     "url": "https://github.com/qistoph/MMM-nstreinen/issues"
gielekee commented 4 years ago

qistoph that fixxed the errors for me thank you!

shibmaster commented 4 years ago

qistoph you are the man! That did definitely resolve the errors during installation, it appears to be working flawlessly now! But there is another error! Apparently, the URL of the NSAPI has changed, therefore you get the 'invalid API KEY' error for actually working APIs. I found out using the NS API console, that the URL in nsapi.js needs to be changed (at least in some places) from :

/reisinformatie-api/api/v2/

to:

/public-reisinformatie/api/v2/

where is stations, arrivals, etc.

If you just REPLACE the above in nsapi.js in all seven spots, everything works for me!

Maybe you can check this also and update the branch?

Thanks a lot, I'm so happy to know when trains are delayed from a glance at my mirror! :)

gielekee commented 4 years ago

I only now get "Error fetching NS info: invalid API key" im using the "Public-Travel-Information" API. Is this the good one?

gielekee commented 4 years ago

Shibmaster used your fix! It works now thanks!

qistoph commented 4 years ago

Fixed the 'v3' branch and an issue with fetching trips between stations: https://github.com/qistoph/MMM-nstreinen/commit/9596889ffbe999c31876ac0413fe7a71e04fea9c

qistoph you are the man! That did definitely resolve the errors during installation, it appears to be working flawlessly now! But there is another error! Apparently, the URL of the NSAPI has changed, therefore you get the 'invalid API KEY' error for actually working APIs. I found out using the NS API console, that the URL in nsapi.js needs to be changed (at least in some places) from :

/reisinformatie-api/api/v2/

to:

/public-reisinformatie/api/v2/

where is stations, arrivals, etc.

If you just REPLACE the above in nsapi.js in all seven spots, everything works for me!

Maybe you can check this also and update the branch?

Thanks a lot, I'm so happy to know when trains are delayed from a glance at my mirror! :)

This should actually be fixed in the ns-api module I'm just using in this project. As you can see in one of the issues there https://gateway.apiportal.ns.nl/reisinformatie-api is actually the new API.

You might have to additionally subscribe to that API on the NS API website.

RaspNewby commented 4 years ago

@qistoph thanks for your efforts! It works now!