Description
After receiving the following error:
npm ERR! JSON.parse Failed to parse package.json data.
I opened the package.json file and saw this:

The author field should be one line of course.
System Details
| Name | Value |
| ----- | ----- |
| Wails Version | v0.17.0 |
| Go Version | go1.12.7 |
| Platform | windows |
| Arch | amd64 |
| GO111MODULE | (Not Set) |
Additional Details
The author data was provided during wails init using Git Bash.
I'm guessing they're picked up from the original wails init command and windows line feeds. If you edit .wails/wails.json in your home directory then that should fix it
I can confirm that this is a Git Bash issue. wails setup works fine using cmd.exe.
Thanks for this update. Windows testing has all been done on cmd.exe so that might fix your other issue with the returns. Whilst we try to support as many setups as possible, we don't always have the bandwidth. The most likely scenario in the future is support for Microsoft's new terminal. Is there a general feeling in the Windows world that this will likely be the de-facto terminal?
The most likely scenario in the future is support for Microsoft's new terminal. Is there a general feeling in the Windows world that this will likely be the de-facto terminal?
Never heard about that. I only know about cmd and PowerShell.
Everybody despises cmd. It is a terrible terminal (or "command prompt") and I don't bother to learn PowerShell because I often switch from macOS to Linux and Windows. They all have bash in common (if Git Bash is installed), so that's what I always use (or zsh, but it is quite similar to bash).
That's understandable. I had a look at using survey instead of stdlib for input and that fails on git bash too. Do your other go based cli tools work ok in it?
I usually do not mind how the CLI tool is written, as long as it works. So no, unfortunately I do not know any Go-based CLI tool.
An easy fix for this issue would be to remove any \r and \n during the concatenation process (name + "<" + email + ">").
Edit:
Related:
https://github.com/wailsapp/wails/blob/63f1767755de8f7dbfd09beed624f6685b894831/cmd/templates/create-react-app/frontend/package.json.template#L3
https://github.com/wailsapp/wails/blob/1ce062062062d6299c153f8c8492ffed59d940e6/cmd/templates/vuetify-basic/frontend/package.json.template#L3
https://github.com/wailsapp/wails/blob/6cf01b423926cd531fbfb9d3512f5456afdf5b50/cmd/templates/vuebasic/frontend/package.json.template#L3
Perhaps I was wrong and you should go deeper than that. These lines are the lines that are related, right?
https://github.com/wailsapp/wails/blob/7dd42f964b4998323668a17cddd64ecd11a67190/cmd/project.go#L124-L125
In that case, is it possible to do a string replace on it, replacing \r and \n with "" (nothing)?
You could argue that this is a dirty fix though. Ideally the console input would not add any \r or \n at all.
Edit 2:
I am not very familiar with Go yet, but an online search suggests using:
strings.TrimRight(the_string_in_question, "\r\n")
Thanks for your feedback @pedzed. I think I have a fairly trivial fix pushed to the latest pre-release for you. Please update to v0.17.9-pre using wails update -pre and test again. This should also fix your git bash support.
Let us know! 馃憤
Excellent!
$ cat ~/.wails/wails.json
{"email":"[email protected]","name":"Ped"}
I didn't have to modify anything either (except in already wails init-ed projects).
New lines also work (#166):
$ wails setup
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ ) v0.17.9-pre
|__/|__/\__,_/_/_/____/ https://wails.app
The lightweight framework for web-like apps
What is your name (Ped):
What is your email address ([email protected]):
Only a minor thing in regards to the generated frontend/package.json after running wails init, there should be a space after the name and before the left angle bracket.
$ cat frontend/package.json
{
"name": "x",
"author": "Ped<[email protected]>",
Thanks for the feedback!
Most helpful comment
Excellent!
I didn't have to modify anything either (except in already
wails init-ed projects).New lines also work (#166):
Only a minor thing in regards to the generated
frontend/package.jsonafter runningwails init, there should be a space after the name and before the left angle bracket.