Skip to content

Postinstall script referencing TYPES_FILE_PATH doesn't exist #799

Description

@mannykary

In the check-types.js postinstall script, this line is referencing a TS file that doesn't exist in the built version of the package. The file that does exist is located at ../esm/types/models.js. The consequence of this issue is that the error is silently failing the postinstall script (and I think in many cases, a lot of users have disabled running postinstall scripts, so they wouldn't even notice this issue).

I was able to confirm this by adding a console.log here, which prints out the following error:

Error: ENOENT: no such file or directory, open '<BASE_PATH>/node_modules/@openrouter/sdk/src/types/models.ts'
    at async open (node:internal/fs/promises:640:25)
    at async readFile (node:internal/fs/promises:1290:14)
    at async main (file:///<BASE_PATH>/node_modules/@openrouter/sdk/scripts/check-types.js:97:23) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '<BASE_PATH>/node_modules/@openrouter/sdk/src/types/models.ts'
}

(Note: I redacted the actual base path with <BASE_PATH> but left the relative path in).

Changing the path to ../esm/types/models.js fixed the issue and printed the warning message as expected:

$ node scripts/check-types.js

OpenRouter model types are outdated.
Run: npx @openrouter/cli types

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions