gis-ops / valhalla-app

This is the demo web app running on https://valhalla.openstreetmap.de
https://valhalla.openstreetmap.de
MIT License
163 stars 90 forks source link

prettier/prettier error in the application #82

Closed harsh5902 closed 1 year ago

harsh5902 commented 1 year ago

Getting such errors in the application. image

Fixed the error: image

harsh5902 commented 1 year ago

I have already solved the issue kindly assign it to me. I will add the code

nilsnolde commented 1 year ago

Getting rid of linking errors is always good. Are those the only ones that pop up though?

harsh5902 commented 1 year ago

Yes, this was the only ones that would pop up as error Yes, whenever the application used to start I would get these error.

Shall I open a pull request??

nilsnolde commented 1 year ago

If you think it's worth it, sure.

nilsnolde commented 1 year ago

Sorry, I just get the issue (I hardly every work with JS). Are you using a different configuration than the default? What's your npm/node version? EDIT: that shouldn't even matter, should be solely the prettier version and configuration and those are fixed, so did you change smth there?

harsh5902 commented 1 year ago

Yes, I made changes in the prettierrc.json file as I was getting this error continuously after starting the web app. So, I fixed it with the thought that many could be facing such error.

nilsnolde commented 1 year ago

But why is no one else getting this error? Do you possibly have a global prettier package installed and not in local node_modules? If so, that'd be a bad idea.

aa98-45556443355666 commented 1 year ago

I am also getting the same prettier error on opening the web application.

nilsnolde commented 1 year ago

And you have which prettier version installed? prettier -v?

nilsnolde commented 1 year ago

Might be Windows related? It's weird that it's complaining on every line, so makes me think it's somehow line ending related (POSIX vs Windows shit)..

nilsnolde commented 1 year ago

If you're on Windows then you have git misconfigured maybe?

Ghat0tkach commented 1 year ago

i am using windows 11, not getting this error , i ran this web application using the not -so traditional method by downloading zip without having git configurations. It worked perfectly . This error might be caused due to improper installations of npm i beleive so.

nilsnolde commented 1 year ago

Hm, not sure how npm can have smth to do with it? If it was somehow "improper" it'd be broken and not run at all (also it's node executing, not npm). It could be an old version, but also that wouldn't show in this way I'm very sure. Also my theory is not very sound.. Why would it only be one file if it's a Windows git misconfig for the line ending checkout/push..

No idea and hard to tell without more info. In any case, it's more smth belonging to stackoverflow.com or so, as it's clearly working for the majority.

aa98-45556443355666 commented 1 year ago

And you have which prettier version installed? prettier -v?

Its "prettier": "^2.7.1" version.

nilsnolde commented 1 year ago

Do you possibly have a global prettier package installed and not in local node_modules? If so, that'd be a bad idea.

Well then this is correct.. This project uses 2.8.4. Don't install global packages (EDIT: for dev at least, it's ok to install executable to be used from npm but never dev dependencies!), esp linting stuff, it's asking for trouble.

aa98-45556443355666 commented 1 year ago

Do you possibly have a global prettier package installed and not in local node_modules? If so, that'd be a bad idea.

Well then this is correct.. This project uses 2.8.4. Don't install global packages (EDIT: for dev at least, it's ok to install executable to be used from npm but never dev dependencies!), esp linting stuff, it's asking for trouble.

Now the problem is solved. Thanks for giving the correct method.

nilsnolde commented 1 year ago

Hm sorry, what you were writing is the semantic minimum version. Is that really your version? I mean I can read this package.json, but I can't execute npm --version in your environment.

Now, it is possible that you installed this repo (and its deps) ages ago when prettier was still at 2.7.1 on npm and in the meantime we introduced some crap that's not compatible with 2.7.1 anymore, but I highly doubt that.

So, again, it's most likely the prettier version you have installed.. which prettier should point to your local node_modules.