trymodule
trymodule copied to clipboard
REPL cannot start due to error with loading history
I get this error when I try to run anything e.g. trymodule lodash
:
Gonna start a REPL with packages installed and loaded for you
Couldn't find 'lodash' locally, gonna download it now
[email protected] .trymodule/node_modules/lodash
Package 'lodash' was loaded and assigned to 'l' in the current scope
REPL started...
/usr/local/lib/node_modules/trymodule/node_modules/repl.history/index.js:19
repl.rli.addListener('line', function(code) {
^
TypeError: Cannot read property 'addListener' of undefined
at module.exports (/usr/local/lib/node_modules/trymodule/node_modules/repl.history/index.js:19:12)
at /usr/local/lib/node_modules/trymodule/cli.js:72:7
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
I've done basic clean up steps i.e. uninstall trymodule
and delete the ~/.trymodule/
folder (or trymodule --clear
).
I don't understand why it fails here.
@lordlycastle Which node version do you use?
I just ran into this. :[
$ trymodule file-size
Gonna start a REPL with packages installed and loaded for you
Couldn't find 'file-size' locally, gonna download it now
[email protected] ../../../.trymodule/node_modules/file-size
Package 'file-size' was loaded and assigned to 'file_size' in the current scope
REPL started...
/Users/z/.npm-global/lib/node_modules/trymodule/node_modules/repl.history/index.js:19
repl.rli.addListener('line', function(code) {
^
TypeError: Cannot read properties of undefined (reading 'addListener')
at module.exports (/Users/z/.npm-global/lib/node_modules/trymodule/node_modules/repl.history/index.js:19:12)
at /Users/z/.npm-global/lib/node_modules/trymodule/cli.js:72:7
at processTicksAndRejections (node:internal/process/task_queues:96:5)
~/git/replicate/replicate-web main*
$ node --version
v16.9.0
This issue is related with repl.history
which is used in this module.
The node's repl
API (REPLServer.rli) changed after Node 16.
The repl.rli.addListener
should be replaced with repl.addListener
.