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 crash when a file is not found instead responding with a 404 #235

Open
lucamug opened this issue Jul 6, 2020 · 4 comments
Open

Comments

@lucamug
Copy link
Contributor

lucamug commented Jul 6, 2020

If you try an url for a non existing file, for example: http://localhost:8000/xyz/index.html

elm-live will stop with the error:

internal/fs/utils.js:537
    throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at readFile (fs.js:313:10)
    at /Users/userName/projectName/node_modules/crocks/Async/index.js:54:10
    at Object.fork (/Users/userName/projectName/node_modules/crocks/Async/index.js:155:20)
    at /Users/userName/projectName/node_modules/crocks/Async/index.js:254:41
    at settle (/Users/userName/projectName/node_modules/crocks/Async/index.js:151:16)
    at ReadFileContext.callback (/Users/userName/projectName/node_modules/crocks/Async/index.js:56:47)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:257:13) {
  code: 'ERR_INVALID_ARG_TYPE'
}
node /Users/userName/projectName/elm-start/src-js/start.js serverDev exited with code 0

Could be related to

#207
#205
#195

lucamug added a commit to lucamug/elm-go that referenced this issue Jul 6, 2020
Fix the issue that for not existing file (i.e. https://localhost:8000/xyz/index.html), elm-live was crashing (wking-io#235)
@francisdb
Copy link

francisdb commented Aug 17, 2020

I can confirm this issue. I saw it after checking a fresh repo and freshly installing elm-live. I guess it was trying to load the index before it was fully built

elm-live --version
4.0.2
git:(master) elm-live src/Main.elm --open

elm-live:
  Server has been started! Server details below:
    - Website URL: http://localhost:8000
    - Serving files from: /Users/foo/xxx/glmorph


internal/fs/utils.js:535
    throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at readFile (fs.js:313:10)
    at /Users/foo/.nvm/versions/node/v12.16.3/lib/node_modules/elm-live/node_modules/crocks/Async/index.js:54:10
    at Object.fork (/Users/foo/.nvm/versions/node/v12.16.3/lib/node_modules/elm-live/node_modules/crocks/Async/index.js:155:20)
    at /Users/foo/.nvm/versions/node/v12.16.3/lib/node_modules/elm-live/node_modules/crocks/Async/index.js:254:41
    at settle (/Users/foo/.nvm/versions/node/v12.16.3/lib/node_modules/elm-live/node_modules/crocks/Async/index.js:151:16)
    at ReadFileContext.callback (/Users/foo/.nvm/versions/node/v12.16.3/lib/node_modules/elm-live/node_modules/crocks/Async/index.js:56:47)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:257:13) {
  code: 'ERR_INVALID_ARG_TYPE'
}

@erlandsona
Copy link

Anyone have a fork with this fixed? Been dealing with this same issue as well.

@lucamug
Copy link
Contributor Author

lucamug commented Feb 11, 2021

Anyone have a fork with this fixed? Been dealing with this same issue as well.

At work we use elm-go, a clone that we made to fix some issues of elm-live

@helldorado
Copy link

This occurs when the index.html file is missing from the --dir

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

4 participants