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

TypeError: arg.startsWith is not a function #397

Closed
matthewswitzer opened this issue Aug 31, 2022 · 10 comments
Closed

TypeError: arg.startsWith is not a function #397

matthewswitzer opened this issue Aug 31, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@matthewswitzer
Copy link

Hello, I seem to be running into an issue with v0.22.1 on macOS 12.5.1. When trying to pass input through, it's reporting TypeError: arg.startsWith is not a function. This seems to be isolated to macOS only as 0.22.1 works fine on my Ubuntu 22.04 machine.

Downgrading to v0.22.0 seems to run fine without any issues on macOS.

@fsouza fsouza added the bug Something isn't working label Aug 31, 2022
@fsouza
Copy link
Owner

fsouza commented Aug 31, 2022

Hmm interesting. Are you able to provide full repro steps? I use macOS 12.5.1 and don't see this issue.

I'll try to trace the code to check whether we missed something in the integration with core_d.

@matthewswitzer
Copy link
Author

Sure, I'm cding into an empty directory with this test file and running the steps below.

test.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="css/style.css" rel="stylesheet">
    </head>
    <body>
    
    </body>
</html>

Steps to Reproduce

$ npm i @fsouza/prettierd@0.22.1

$ cat test.html | npx prettierd test.html
TypeError: arg.startsWith is not a function

$ npm i @fsouza/prettierd@0.22.0

$ cat test.html | npx prettierd test.html
<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link href="css/style.css" rel="stylesheet" />
    </head>
    <body></body>
</html>

Version Information

os: macOS 12.5.1
node: v18.8.0
npm: 8.18.0

@fsouza
Copy link
Owner

fsouza commented Aug 31, 2022

🤔 this is weird. Which terminal emulator and shell are you using? I'll try to use the same setup to reproduce.

@matthewswitzer
Copy link
Author

I'm using iTerm 2 with zsh. Running it in terminal.app seems to be giving off the same error.

@fsouza
Copy link
Owner

fsouza commented Aug 31, 2022

I'm using iTerm 2 with zsh. Running it in terminal.app seems to be giving off the same error.

Thanks for confirming. I traced the code a bit and noticed something potentially related with how we disable colors. I fixed that and pushed 0.22.2. Can you give it a shot?

@matthewswitzer
Copy link
Author

Still running into the same error with 0.22.2.

@fsouza
Copy link
Owner

fsouza commented Aug 31, 2022

@matthewswitzer thanks for confirming. I'll try to reproduce the setup/error later today.

@fsouza
Copy link
Owner

fsouza commented Sep 1, 2022

@matthewswitzer any chance your daemon is old? You're likely using the new client with the older daemon. pkill prettierd after the upgrade should fix it.

@fsouza
Copy link
Owner

fsouza commented Sep 1, 2022

To add more context: 0.22.1 changed the format of the data that is sent to the server, so if you're using the client on version 0.22.1 and the server on version 0.22.0, you're going to get that error.

It was totally my mistake to make a breaking change in a patch release, this should've been 0.23.0, but making the change did improve the tool overall.

Example on how to reproduce on any system:

% pkill prettierd
% npx --package @fsouza/prettierd@0.22.0 prettierd start
% echo "var x=1" | npx --package @fsouza/prettierd@0.22.1 prettierd file.js

@matthewswitzer
Copy link
Author

I think that was it. Running pkill prettierd after upgrading seems to have fixed it. Thanks for your help!

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

2 participants