Skip to content

TypeError: cacheDir is not a function #107

@domharrington

Description

@domharrington

I got this error when testing out the API module on our reference guide: https://docs.readme.com/developers/reference/projects

const sdk = require('api')('https://docs.readme.com/developers/openapi/5e1a4f6284248b0018149174');

sdk.getProject()
  .then(res => res.json())
  .then(res => {
    console.log(res);
  });

I saved it to /tmp/node-simple.js and ran npm install api, then ran node node-simple.js and got the following error:

$ node node-simple.js
/private/tmp/node_modules/api/src/cache.js:17
    this.dir = cacheDir();
               ^

TypeError: cacheDir is not a function
    at new SdkCache (/private/tmp/node_modules/api/src/cache.js:17:16)
    at Sdk.load (/private/tmp/node_modules/api/src/index.js:31:19)
    at module.exports.uri (/private/tmp/node_modules/api/src/index.js:141:23)
    at Object.<anonymous> (/private/tmp/node-simple.js:1:27)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)

Confusingly when it's in another directory it works as intended? Could this be an error in running from /tmp? I use it exclusively for messing around with stuff like this.

Metadata

Metadata

Assignees

Labels

area:coreIssues related to `core`, which is the package that powers the SDKs at runtimebugSomething isn't workingquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions