API-Flow icon indicating copy to clipboard operation
API-Flow copied to clipboard

Install via NPM/Yarn fails

Open tecfu opened this issue 6 years ago • 0 comments

To repeat:

npm install philsturgeon/API-flow --save-dev
const ApiFlow = require('api-flow').default; // if from yarn/npm
const path = require('path');
const options = {
    source: {
        format: 'swagger',
        version: 'v2.0'
    },
    target: {
        format: 'raml',
        version: 'v1.0'
    }
}

const promise = ApiFlow.transform({
  options,
  uri: path.resolve(__dirname, './my_super_swagger.yml')
})

promise.then((data) => {
  // do some cool stuff with the data
})

Result:

Error: Cannot find module '/myproject/node_modules/api-flow/dist/node/api-flow.js'. Please verify that the package.json has a valid "main" entry

Why?

You don't add a build step in package.json, so dist/node/api-flow.js is never created.

tecfu avatar Dec 08 '19 01:12 tecfu