Edits to post are to fix typos and improve readability
Summary of Problem
Apologies if I’m missing something simple. I’m self taught in all this development, and am desperately trying to follow the openrouteservices-js install instructions but am having trouble, and could use some help.
My Background and Overall Project Goal
I spent the past couple years making a website www.tucsonpathways.org and building an interactive webmap at www.Tucsonpathways.org/map to create better bicycle navigation of my city. I want to switch over from using the Mapbox Directions API to Openrouteservice-js API as an initial first step. (Eventually I want to use the Java based ORS API to customize the Weights and flagEncouters of the road network to truly prioritize my roads, but for now just installing the default Openrouteservice-js API is my starting point.)
My Troubleshooting Thusfar
I’m following the steps on the github as well as I can but having some trouble. I have searched for some time through Stack Overflow but haven’t found support for this problem.
Step 1. I run
npm install openrouteservice-js --save
- this creates the
node_modulesfolder for me and all dependent packages.
node_modules/openrouteservice-jsfolder is also created, but doesn’t create the
- I’m assuming that is done with the next command(?) or am I making a mistake already?
Step 2. Assuming ‘Step 1’ was correct, I then
cd node_modules/openrouteservice-js into the folder, and
npm run bundleProduction
- I get the following:
npm ERR! missing script: bundleProduction npm ERR! npm ERR! Did you mean this? npm ERR! browserBundleProduction
I’m unsurprised by the above error, because when i open up the
node_module/openrouteservice-js/package.json there is no script file named
Step 3. I then run
npm run broswerBundleProduction as an alternative, I get the following error:
The system cannot find the path specified. npm ERR! code ELIFECYCLE npm ERR! errno 255 npm ERR! firstname.lastname@example.org browserBundleProduction: `browserify -g uglifyify src/index.js -t babelify --presets @babel/preset-env --plugins transform-class-properties | derequire > dist/ors-js-client.js` npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the email@example.com browserBundleProduction script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?
I’m unsurprised by this above error, because the
browserBundleProduction script in the
node_module/openrouteservice-js/package.json calls upon the
src subfolders which were never installed in the first place during the
npm install openrouteservice-js --save command… I know I’m new a this, but I didn’t think I made a mistake right at Step 1.
Step 4 & Beyond. It is somewhat unclear where to put the:
import Joi from "joi" ...
I assume the above section of code is to go into a
<scripts> tag in my
package.json. Also it looks like I also need npm packages like
babelify… Of course its not hard for me to install those myself with some
npm install ________ --save commands, but I thought these would be installed during the initial
npm install openrouteservice-js --save command?
I’ve spent a lot of time researching this and trying to troubleshoot a wide variety of solutions on my own before asking the forums, so I would appreciate someone taking the time to reply.
Thanks in advance,