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

Unexpected token with dev-server watch #476

Open
simatec opened this issue Jul 1, 2024 · 5 comments
Open

Unexpected token with dev-server watch #476

simatec opened this issue Jul 1, 2024 · 5 comments

Comments

@simatec
Copy link

simatec commented Jul 1, 2024

I have moved my development environment to a dev server and have the following problem for the backup adapter. I create the dev-server with dev-server setup backitup. If I start the dev-server afterwards with dev-server run backitup everything runs as intended and I can also perform tests in the environment during the backup.

However, if I start with dev-server watch backitup I get the following error message when creating the backup.

[iobroker] error on backup: SyntaxError: Unexpected token ':' Please run "iobroker fix" and reinstall BackItUp

https://github.com/simatec/ioBroker.backitup/blob/eb7e44e9ed49c909ffdbe0b022ec6e433f295627/lib/execute.js#L15

If I then start dev-server run backitup again, the error still occurs.

Only a dev-server setup backitup --force fixes the error, but of course resets everything to default.

Translated with DeepL.com (free version)

@Apollon77
Copy link
Collaborator

Apollon77 commented Jul 1, 2024

Can you maybe log the file content he would execute because seems that the file he reads is invalid JS and maybe log the file heprocesses to see which file i tis which is broken

@simatec
Copy link
Author

simatec commented Jul 1, 2024

When the backup is executed, execute.js is executed.
The error message occurs when reading in the individual backup scripts line 15.

Is that what you mean?

@simatec
Copy link
Author

simatec commented Jul 1, 2024

I think I've got to the root of the problem.
The watch mode is mapped and the .js.map files are also in the "scripts" directory
If the files are now read, they are of course incorrect.
I have now added an if (!file.includes('.map')) to the code

@Apollon77
Copy link
Collaborator

or just ".endsWith(".js")" ?

@simatec
Copy link
Author

simatec commented Jul 1, 2024

That works too, of course ;)

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

2 participants