pelias-deprecated / dockerfiles

Containerized Local Installation Package for the Pelias geocoder
https://pelias.io
MIT License
32 stars 25 forks source link

Docker npm error #33

Closed ktjaco closed 6 years ago

ktjaco commented 6 years ago

Thank you for creating this Pelias docker container! I've been following along the "How to setup" guide and I come across an error following the ​docker-compose​ ​ run​ ​ --rm​ ​ whosonfirst​ ​ npm​ ​ run​ ​ download command.

user@ubuntu:~/osGeo/pelias/dockerfiles$ docker-compose run --rm whosonfirst npm run download
Starting pelias_baseimage ... 
Starting pelias_baseimage ... done

> pelias-whosonfirst@0.0.0-semantic-release download /code/pelias/whosonfirst
> node ./utils/download_data.js

/code/pelias/whosonfirst/node_modules/mergeable/lib/Mergeable.js:70
    throw new Error( 'failed to merge config from path:' + path );
    ^

Error: failed to merge config from path:/code/pelias.json
    at Config._requirePath (/code/pelias/whosonfirst/node_modules/mergeable/lib/Mergeable.js:70:11)
    at Config.deepMergeFromPath (/code/pelias/whosonfirst/node_modules/mergeable/lib/Mergeable.js:20:21)
    at getConfig (/code/pelias/whosonfirst/node_modules/pelias-config/index.js:45:37)
    at Object.generate (/code/pelias/whosonfirst/node_modules/pelias-config/index.js:23:18)
    at Object.<anonymous> (/code/pelias/whosonfirst/utils/download_data.js:1:105)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)

npm ERR! Linux 4.4.0-97-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "download"
npm ERR! node v4.8.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pelias-whosonfirst@0.0.0-semantic-release download: `node ./utils/download_data.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pelias-whosonfirst@0.0.0-semantic-release download script 'node ./utils/download_data.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pelias-whosonfirst package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./utils/download_data.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs pelias-whosonfirst
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pelias-whosonfirst
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /code/pelias/whosonfirst/npm-debug.log

My pelias.json file is the same as the one in the "How to setup" guide.

{
​ "esclient":​ ​ {
​ ​ ​ ​ "hosts":​ ​ [{​ ​ "host":​ ​ "elasticsearch"​ ​ }]
​ ​ },
​ ​ "api":​ ​ {
​ ​ ​ ​ "textAnalyzer":​ ​ "libpostal",
​ ​ ​ ​ "services":​ ​ {
​ ​ ​ ​ ​ ​ "placeholder":​ ​ {
​ ​ ​ ​ ​ ​ ​ ​ "url":​ ​ "http://placeholder:4100"
​ ​ ​ ​ ​ ​ }
​ ​ ​ ​ }
​ ​ },
​ ​ "imports":​ ​ {
​ ​ ​ ​ "whosonfirst":​ ​ {
​ ​ ​ ​ ​ ​ "datapath":​ ​ "/data/whosonfirst",
​ ​ ​ ​ ​ ​ "importVenues":​ ​ false,
​ ​ ​ ​ ​ ​ "importPostalcodes":​ ​ true,
​ ​ ​ ​ ​ ​ "importPlace":​ ​ "85950361",
​ ​ ​ ​ ​ ​ "api_key":​ ​ "your-mapzen-api-key"
​ ​ ​ ​ }
​ ​ }
}

Any help on this error would be much appreciated!

orangejulius commented 6 years ago

Hey @ktjaco, Thanks for reporting this. I think there's a problem where copying/pasting the JSON from that PDF brings along invalid whitespace. I copied your JSON and it looked like this in vim: image

That, combined with our confusing JSON error messages makes this very hard to debug indeed.

Please let me know if there is indeed invalid whitespace in your pelias.json and if fixing that whitespace makes everything work. We'll try to improve the PDF if we can. I know there's also a Google Docs version of the tutorial where copy/paste works fine, so it should be possible.

ktjaco commented 6 years ago

@orangejulius The white space in the pelias.json file didn't seem to be the problem. I removed all spaces and I got the space error.

user@ubuntu:~/osGeo/pelias/dockerfiles$ docker-compose run --rm whosonfirst npm run download
Starting pelias_baseimage ... 
Starting pelias_baseimage ... done

> pelias-whosonfirst@0.0.0-semantic-release download /code/pelias/whosonfirst
> node ./utils/download_data.js

/code/pelias/whosonfirst/node_modules/mergeable/lib/Mergeable.js:70
    throw new Error( 'failed to merge config from path:' + path );
    ^

Error: failed to merge config from path:/code/pelias.json
    at Config._requirePath (/code/pelias/whosonfirst/node_modules/mergeable/lib/Mergeable.js:70:11)
    at Config.deepMergeFromPath (/code/pelias/whosonfirst/node_modules/mergeable/lib/Mergeable.js:20:21)
    at getConfig (/code/pelias/whosonfirst/node_modules/pelias-config/index.js:45:37)
    at Object.generate (/code/pelias/whosonfirst/node_modules/pelias-config/index.js:23:18)
    at Object.<anonymous> (/code/pelias/whosonfirst/utils/download_data.js:1:105)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)

npm ERR! Linux 4.4.0-97-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "download"
npm ERR! node v4.8.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pelias-whosonfirst@0.0.0-semantic-release download: `node ./utils/download_data.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pelias-whosonfirst@0.0.0-semantic-release download script 'node ./utils/download_data.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pelias-whosonfirst package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./utils/download_data.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs pelias-whosonfirst
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pelias-whosonfirst
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /code/pelias/whosonfirst/npm-debug.log

user@ubuntu:~/osGeo/pelias/dockerfiles$ cat pelias.json 
{
"esclient":​​{
"hosts":​​[{​​"host":​​"elasticsearch"​​}]
},
"api":​​{
"textAnalyzer":​​"libpostal",
"services":​​{
"placeholder":​​{
"url":​​"http://placeholder:4100"
}
}
},
"imports":​​{
"whosonfirst":​​{
"datapath":​​"/data/whosonfirst",
"importVenues":​​false,
"importPostalcodes":​​true,
"importPlace":​​"85950361",
"api_key":​​"api-key"
}
}
}

user@ubuntu:~/osGeo/pelias/dockerfiles$ docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
<none>                       <none>              8b557f037cc8        3 days ago          301MB
<none>                       <none>              4b9b102bc675        3 days ago          584MB
<none>                       <none>              f750c91ecee7        3 days ago          2.83GB
ubuntu                       latest              747cb2d60bbe        6 days ago          122MB
pelias/api                   latest              d9f9e5e74885        6 days ago          3GB
pelias/polylines             latest              f55d80a5fd76        6 days ago          813MB
pelias/schema                latest              cfe22c9097e1        6 days ago          382MB
pelias/openaddresses         latest              b3e8f8865877        6 days ago          379MB
pelias/interpolation         latest              dd9f4f55ec00        2 weeks ago         3.01GB
pelias/placeholder           latest              7334948c2942        2 weeks ago         381MB
pelias/pip-service           latest              cde13d8eafb7        2 weeks ago         380MB
pelias/whosonfirst           latest              c8a45c38c4cb        2 weeks ago         374MB
elasticsearch                2.4                 6208a3b31b7e        5 weeks ago         573MB
pelias/libpostal_baseimage   latest              e4c5b745b083        6 weeks ago         2.82GB
pelias/baseimage             latest              7db56989135f        6 weeks ago         299MB
pelias/document-service      latest              fd9ed7703511        2 months ago        1.06GB
pelias/openstreetmap         latest              a189956b42bf        2 months ago        481MB
pelias/elasticsearch         latest              4c5c1a5e6cb0        2 months ago        320MB
orangejulius commented 6 years ago

Hey @ktjaco, When I copied and pasted your pelias.json output I still see them there: image

I did some sleuthing and it looks like iconv can help. It was installed on my ubuntu instance but may need to be installed.

Try something like this:

iconv -c -f utf-8 -t ascii pelias.json > pelias2.json

And see if the resulting file looks better.

Sorry again for the inconvenience. Blame PDFs :P

ktjaco commented 6 years ago

@orangejulius Looks like the whitespace was the issue! Thank you so much! :)