node-osmosis
node-osmosis copied to clipboard
Docker container Segmentation fault
/app # node index.js
(get) [redirect] http://www.craigslist.org/about/sites -> https://www.craigslist.org/about/sites
Segmentation fault (core dumped)
content of index.js just example of the code
var osmosis = require('osmosis');
osmosis
.get('www.craigslist.org/about/sites')
.find('h1 + div a')
.set('location')
.follow('@href')
.find('header + div + div li > a')
.set('category')
.follow('@href')
.paginate('.totallink + a.button.next:first')
.find('p > a')
.follow('@href')
.set({
'title': 'section > h2',
'description': '#postingbody',
'subcategory': 'div.breadbox > span[4]',
'date': 'time@datetime',
'latitude': '#map@data-latitude',
'longitude': '#map@data-longitude',
'images': ['img@src']
})
.data(function(listing) {
// do something with listing data
})
.log(console.log)
.error(console.log)
.debug(console.log)
docker file
FROM node:8 // or alpine version no matter
WORKDIR /app
RUN { \
echo "npm install && \\"; \
echo "node index.js"; \
} > /root/run_build.sh
CMD [ "sh", "/root/run_build.sh" ]
EXPOSE 4300
I know that there should be python installed, but no matter whether it installed or not I got segmentation fault and there are no errors or warning during npm install
. Seems like Readme MUST be updated with instructions about what dependencies must be resolved at OS side before using osmosis. For now it is not enough just to do npm install
.
Just run to the same issue. npm i --build-from-source
solves my case. It is to rebuild libxmljs
from source