Closed stefanocudini closed 5 years ago
another simimlar problem, in this way like as documented in the README:
$ node index.js
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module './OrsDirections'
I think this library is not organized according to the specific npm standards :(
this work but isn't a standard node packaging: const OrsDirections = require("./node_modules/openrouteservice-js/src/OrsDirections");
related issue: https://github.com/Keplerjs/keplerjs-openrouteservice/issues/5
@stefanocudini can I close this issue?
I'm sorry but this problem still remains
I think it's a pretty serious problem because, this causes difficulties for non-expert developers when I want to integrate this npm package into other software you should create a test page that included the npm package code in a standard way.
When I try to include this module in standard way:
var Ors = require('openrouteservice-js');
I'm recevice this error: Error: Cannot find module '../schemas/OrsmatrixSchema'
@stefanocudini very sorry about this, definitely my bad.. I moved the schemas to the src folder which are now respected by the npm build - please try version 0.0.9
from npm with npm i openrouteservice-js@0.0.9
- it works for my simple express setup:
var ors = require('openrouteservice-js');
// add your api_key here
const Directions = new ors.Directions({
api_key: "XY"
});
Directions.calculate({
coordinates: [[8.690958, 49.404662], [8.687868, 49.390139]],
....
Let me know if it works.
I have this file test.js
running this in nodejs v10.6.0, cause: