Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow paper to be required in node REPL #2011

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

akre54
Copy link

@akre54 akre54 commented Nov 25, 2022

Attempting to require paper outside of a file context (i.e the node command line repl) leads to an error loading the path because parent.filename is undefined.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at __node_internal_captureLargerStackTrace (node:internal/errors:477:5)
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:115:11)
    at Object.dirname (node:path:1276:5)
    at Object.<anonymous> (/.../node_modules/paper/dist/node/self.js:22:48)

This adds a short-circuit check which seems to fix the issue.

Attempting to require paper outside of a file context (i.e the node command line repl) leads to an error loading the path because `parent.filename` is undefined.

```
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at __node_internal_captureLargerStackTrace (node:internal/errors:477:5)
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:115:11)
    at Object.dirname (node:path:1276:5)
    at Object.<anonymous> (/.../node_modules/paper/dist/node/self.js:22:48)
```

This adds a short-circuit check which seems to fix the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant