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

elm-live dies hard when it cant find output files. #2305

Open
thepowercare opened this issue Jun 5, 2023 · 8 comments
Open

elm-live dies hard when it cant find output files. #2305

thepowercare opened this issue Jun 5, 2023 · 8 comments

Comments

@thepowercare
Copy link

Quick Summary:
When using the community elm container. I'm getting a crash when opening localhost:8012

SSCCE

node ➜ /workspaces/elmish-dev-002 $ npm run watch

[email protected] watch
elm-live src/Main.elm --port=8012 -- --output=dist/index.js

elm-live:
Server has been started! Server details below:
- Website URL: http://localhost:8012
- Serving files from: /workspaces/elmish-dev-002

Error parsing result: SyntaxError: Unexpected number in JSON at position 2
at JSON.parse ()
at ChildProcess. (/workspaces/elmish-dev-002/node_modules/elm-live/lib/src/build.js:110:33)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
{
build: {
action: 'error',
data: '\n' +
'-- ERROR -----------------------------------------------------------------------\n' +
'\n' +
'I ran into something that bypassed the normal error reporting process! I\n' +
'extracted whatever information I could from the internal error:\n' +
'\n' +
'> dist/index.js: openBinaryFile: permission denied (Permission denied)\n' +
'\n' +
'These errors are usually pretty confusing, so start by asking around on one of\n' +
'forums listed at https://elm-lang.org/community to see if anyone can get you\n' +
'unstuck quickly.\n' +
'\n' +

},

  • Elm:
  • 0.19.1
  • Browser:
  • Any
  • Operating System:
  • Windows 10 - WSL2
  • Also running iis on the machine and port 8000 already occupied.

Additional Details

package.json
{
"name": "elmish-dev-002",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"watch": "elm-live src/Main.elm --port=8012 -- --debug --output=dist/index.js",
"compile": "elm make src/Main.elm --output=dist/index.js",
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": [],
"author": "Theodor",
"license": "ISC",
"devDependencies": {
"elm-live": "^4.0.2"
},
"dependencies": {
"elm-format": "^0.8.7"
}
}

@github-actions
Copy link

github-actions bot commented Jun 5, 2023

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

@thepowercare
Copy link
Author

thepowercare commented Jun 5, 2023

Just ran this example, (Attached) which is a lean version of my startup. To my surprise it actually works!
So apparently somethin is up with running the initial version.
elmish-dev-002.zip

@fdbeirao
Copy link
Contributor

fdbeirao commented Jun 5, 2023

Hello @thepowercare

I am also running Windows 10 with WSL 2. I encounter similar issues with permissions some times.

For me, what I ended up doing was adding this to my devcontainer.json:

"postStartCommand": "rootDir=$PWD; cd .. && user=$(whoami); sudo chown $user -Rf $rootDir && mygroup=$(id -gn); sudo chgrp $mygroup -Rf $rootDir && cd $rootDir"

I think the issue also happens depending if you did the git checkout into WSL, or if you are from WSL connecting to a windows path.

For me I ended up doing the git clone inside WSL, to work around the permissions.

Then, in order to keep using my favorite windows Git client (Fork), I opened the repo at \\wsl.localhost\Ubuntu-22.04\home\...

All in all, I don't think this issue is necessarily related to Elm or even to the community dev container, but more likely to how Windows and WSL interact in terms of file permissions.

@thepowercare
Copy link
Author

thepowercare commented Jun 5, 2023 via email

@thepowercare
Copy link
Author

Solved by applying @fdbeirao suggestion :)

@fdbeirao
Copy link
Contributor

fdbeirao commented Jun 5, 2023

If you no longer have the issue, then indeed closing would be the way to go. Indeed, permission issues will usually be associated to how you performed the initial git clone. Glad the problem is solved, have a great day further 🙂

@thepowercare thepowercare reopened this Jun 5, 2023
@thepowercare
Copy link
Author

Solution was short lived :(
Tried using elm-go. This hinted that both lib's are looking in the root folder.
Moving files from my target folder to root solves this problem.

@thepowercare
Copy link
Author

The solution: "watch": "elm-live src/Main.elm --dir=dist --port=8011 -- --debug --output=dist/index.js",

@thepowercare thepowercare changed the title Using elm-live from within devcontainer craches elm-live dies hard when it cant find output files. Jun 5, 2023
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