Title: path resolution fails on Windows · Issue #249 · racketscript/racketscript · GitHub
Open Graph Title: path resolution fails on Windows · Issue #249 · racketscript/racketscript
X Title: path resolution fails on Windows · Issue #249 · racketscript/racketscript
Description: Compiled scripts produce ERR_MODULE_NOT_FOUND exceptions on all of my Windows machines. This seems to have something to do with the paths generated by the compiler and some unexpected behavior from racket/path. Racks is able to successfu...
Open Graph Description: Compiled scripts produce ERR_MODULE_NOT_FOUND exceptions on all of my Windows machines. This seems to have something to do with the paths generated by the compiler and some unexpected behavior from...
X Description: Compiled scripts produce ERR_MODULE_NOT_FOUND exceptions on all of my Windows machines. This seems to have something to do with the paths generated by the compiler and some unexpected behavior from...
Opengraph URL: https://github.com/racketscript/racketscript/issues/249
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"path resolution fails on Windows","articleBody":"Compiled scripts produce `ERR_MODULE_NOT_FOUND` exceptions on all of my Windows machines. This seems to have something to do with the paths generated by the compiler and some unexpected behavior from racket/path.\r\n\r\nRacks is able to successfully compile the program, but when I try to run the module with Node, it errors out trying to import a file called 'untimecore.js'. I took a look through the compiled version of my racket code, and found this at the top of the file:\r\n\r\n`import * as $rjs_core from '..\\runtime\\core.js';`\r\n`import * as M0 from \"..\\runtime\\kernel.rkt.js\";`\r\n`import * as M1 from \"..\\collects\\racket\\private\\modbeg.rkt.js\";`\r\n\r\nThese aren't the intended paths, because the single back-slashes escape characters in the file names. This is why `'..\\runtime\\core.js'` becomes something like `' untimecore.js'`.\r\nI have a working theory for why the paths are being generated this way, although I am new to the codebase, so it could easily be something else.\r\n\r\nI suspected this was a windows-specific problem, so I went looking for how these import statements are built. I found that the function `simple-module-path` in [util.rkt](https://github.com/racketscript/racketscript/blob/f3bddfb52d3a0229b9585db676d498f560eea658/racketscript-compiler/racketscript/compiler/util.rkt) can call `simple-form-path`, which in turn calls [simplify-path](https://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._simplify-path%29%29).\r\n\r\nAccording to the documentation, simplify-path will replace `/` with `\\` on Windows, so it certainly seems like this might be the culprit. However, this isn't a bug with simplify-path but the intended behavior. It might be necessary to go through the code and differentiate between when a path is going to be used with the file system and when the path string is to be used in compiled javascript code.","author":{"url":"https://github.com/arthertz","@type":"Person","name":"arthertz"},"datePublished":"2021-07-27T22:35:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/249/racketscript/issues/249"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7ea6d7c1-d5c0-b8e3-15b1-db5f6fc33a0d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF6E:3BE19:C5E27C:1163EDD:696F6C15 |
| html-safe-nonce | 1e38aa597be7a3b3da112745cdb317956e9f3143f62efd6ed8b1101ab701368c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjZFOjNCRTE5OkM1RTI3QzoxMTYzRUREOjY5NkY2QzE1IiwidmlzaXRvcl9pZCI6IjExMzIxNzMwNDMzNTQ3OTA5MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 219f8d92bd55725c77a5c0fb992d570dc6739c52e3bbcefe7c6b64573b127c93 |
| hovercard-subject-tag | issue:954315733 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/racketscript/racketscript/249/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f5fff84612a89dd4877af52c8afcb6524ac95679f9eae0cdea6a35668c58961/racketscript/racketscript/issues/249 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f5fff84612a89dd4877af52c8afcb6524ac95679f9eae0cdea6a35668c58961/racketscript/racketscript/issues/249 |
| og:image:alt | Compiled scripts produce ERR_MODULE_NOT_FOUND exceptions on all of my Windows machines. This seems to have something to do with the paths generated by the compiler and some unexpected behavior from... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | arthertz |
| hostname | github.com |
| expected-hostname | github.com |
| None | dd6be7b30d2e12704d0d9723ad4a7950f9e3ad8461efc40b5411aad62e847a89 |
| turbo-cache-control | no-preview |
| go-import | github.com/racketscript/racketscript git https://github.com/racketscript/racketscript.git |
| octolytics-dimension-user_id | 42381398 |
| octolytics-dimension-user_login | racketscript |
| octolytics-dimension-repository_id | 52491211 |
| octolytics-dimension-repository_nwo | racketscript/racketscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 52491211 |
| octolytics-dimension-repository_network_root_nwo | racketscript/racketscript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0bab932a9532ed9bc2e3e2614af9348ab39af6a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width