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

Requiring built-in modules throws an error #14

Open
chrissantamaria opened this issue Aug 5, 2019 · 2 comments
Open

Requiring built-in modules throws an error #14

chrissantamaria opened this issue Aug 5, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@chrissantamaria
Copy link

Not sure if I'm missing something here - requiring standard NPM modules works as expected (such as const axios = require('axios')) but any built-in module such as fs or querystring fails:

node v12.4.0 npm@6.9.0 jay-repl@0.2.1
Type `> jay.help()` in the prompt for more information.
> const fs = require('fs')
C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\moduler.js:158
            throw new Error(`\`${id}\` has an invalid \`package.json\` file`);
            ^

Error: `fs` has an invalid `package.json` file
    at C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\moduler.js:158:19
    at Left.getOrElseL (C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\fp-ts\lib\Either.js:127:16)
    at decodePkg (C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\moduler.js:157:13)
    at _resolve (C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\moduler.js:180:21)
    at _require (C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\moduler.js:191:39)
    at evalmachine.<anonymous>:1:12
    at Script.runInContext (vm.js:134:20)
    at Object.<anonymous> (C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\eval.js:94:41)
    at Generator.next (<anonymous>)
    at C:\Users\Chris\AppData\Local\Yarn\Data\global\node_modules\jay-repl\dist\eval.js:7:71
>

I'm on Windows 10 and installed jay globally with Yarn.

@rsify rsify added the bug Something isn't working label Aug 6, 2019
@rsify
Copy link
Owner

rsify commented Aug 6, 2019

definitely shouldn't be happening, thanks.

fyi - just like in the vanilla node repl - all built-in modules are available by default, there's no need to require them.

@talentlessguy
Copy link

having the same issue

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants