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

REPL error: TypeError: Cannot set property 'history' of undefined #2366

Closed
daanmlab opened this issue Mar 10, 2021 · 8 comments
Closed

REPL error: TypeError: Cannot set property 'history' of undefined #2366

daanmlab opened this issue Mar 10, 2021 · 8 comments
Assignees

Comments

@daanmlab
Copy link

daanmlab commented Mar 10, 2021

`TypeError: Cannot set property 'history' of undefined

1 Repl._readHistoryFile
.../.nvm/versions/node/v15.5.0/lib/node_modules/@adonisjs/cli/src/Commands/Repl/index.js:62

2 Repl.handle
.../.nvm/versions/node/v15.5.0/lib/node_modules/@adonisjs/cli/src/Commands/Repl/index.js:109

3 anonymous
.../back-end/node_modules/@adonisjs/ace/src/Command/index.js:565

4 Function.exec
.../back-end/node_modules/@adonisjs/ace/src/Command/index.js:563

5 Function.commanderAction
.../back-end/node_modules/@adonisjs/ace/src/Command/index.js:540

6 Command.listener
.../back-end/node_modules/commander/index.js:315

7 Command.parseArgs
.../back-end/node_modules/commander/index.js:651

8 Command.parse
.../back-end/node_modules/commander/index.js:474

9 Kernel.invoke
.../back-end/node_modules/@adonisjs/ace/src/Kernel/index.js:329

10 Ignitor._invokeAce
.../back-end/node_modules/@adonisjs/ignitor/src/Ignitor/index.js:532

11 Ignitor.fireAce
.../back-end/node_modules/@adonisjs/ignitor/src/Ignitor/index.js:847`

I'm working on an API I used the CLI to create it.
First time trying to start REPL.

System details:
OS: macos big sur 11.2.3
Shell: zsh

@RomainLanz
Copy link
Member

Hey @daanmlab! 👋

Could you be a bit more descriptive, there's no way for us to help you with the amount of information you shared.

@RomainLanz RomainLanz self-assigned this Mar 11, 2021
@daanmlab
Copy link
Author

Hey @daanmlab! 👋

Could you be a bit more descriptive, there's no way for us to help you with the amount of information you shared.

Added some details. Sorry for being vague first time reporting an issue

@McSneaky
Copy link
Contributor

Added some details. Sorry for being vague first time reporting an issue

Can you share some code?

Most likely you have something like this:

const user = await User.find(10)
user.history = 'foobar' // throws "Cannot set property 'history' of undefined" if user with ID 10 does not exist

@daanmlab
Copy link
Author

Added some details. Sorry for being vague first time reporting an issue

Can you share some code?

Most likely you have something like this:

const user = await User.find(10)
user.history = 'foobar' // throws "Cannot set property 'history' of undefined" if user with ID 10 does not exist

just the be clear the code itself runs without any errors I only get an error when I try adonis repl

@daanmlab
Copy link
Author

daanmlab commented Mar 12, 2021

Could it be because of the big sur update @RomainLanz ?

@RomainLanz
Copy link
Member

RomainLanz commented Mar 12, 2021

No, it's because the rli.history has been deprecated and removed in Node.

Please, downgrade your Node version for now if you want to use Adonis 4.
Closing since we already have an issue on same adonisjs/adonis-cli#190

@daanmlab
Copy link
Author

okay thanks for letting me know

@poldfcb
Copy link

poldfcb commented Jul 7, 2021

a momentary fix is that you can comment the next two lines, and the repl will be ok. (ofcs you'll not be able to get the history of your repl)
comment the line 109 y 110
imagen

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

No branches or pull requests

4 participants