Gatsby: Gatsby Develop Seems to not support non-ASCII in absolute path

Created on 17 May 2019  Â·  12Comments  Â·  Source: gatsbyjs/gatsby

Description

Gatsby Develop seems to not support non-ASCII characters in absolute path
The error is very similar to #11807

I created the hello-world starter project inside a folder called "Skýggjið". When I then ran gatsby develop, it resulted in an error. Changing the folder name "Skýggjið" to "Skyggjid" makes the error go away.

Steps to reproduce

  1. Create a folder with non-ASCII characters, example "skýggjið"
  2. run gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
  3. run gatsby develop

Expected result

It should compile successully

Actual result

Output from gatsby develop:

D:\gatsby\Skýggjið\hello-world>gatsby develop
success open and validate gatsby-configs — 0.005 s
success load plugins — 0.045 s
success onPreInit — 0.005 s
success initialize cache — 0.007 s
success copy gatsby files — 0.101 s
success onPreBootstrap — 0.011 s
success source and transform nodes — 0.018 s
success building schema — 0.149 s
success createPages — 0.000 s
success createPagesStatefully — 0.072 s
success onPreExtractQueries — 0.000 s
success update schema — 0.024 s
success extract queries from components — 0.123 s
success run static queries — 0.002 s
success run page queries — 0.025 s — 2/2 83.63 queries/second
success write out page data — 0.010 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.000 s

info bootstrap finished - 6.048 s

error UNHANDLED EXCEPTION


  Error: no parsers registered for: "\"

  - parser.js:473 parse
    [hello-world]/[snapdragon]/lib/parser.js:473:15

  - parser.js:477 Parser.parse
    [hello-world]/[snapdragon]/lib/parser.js:477:24

  - index.js:122 Snapdragon.parse
    [hello-world]/[snapdragon]/index.js:122:28

  - braces.js:40 Snapdragon.<anonymous>
    [hello-world]/[braces]/lib/braces.js:40:45

  - braces.js:66 Braces.parse
    [hello-world]/[braces]/lib/braces.js:66:26

  - braces.js:87 Braces.expand
    [hello-world]/[braces]/lib/braces.js:87:18

  - index.js:142 create
    [hello-world]/[braces]/index.js:142:15

  - index.js:298 memoize
    [hello-world]/[braces]/index.js:298:13

  - index.js:165 Function.braces.create
    [hello-world]/[braces]/index.js:165:10

  - index.js:81 Function.braces.expand
    [hello-world]/[braces]/index.js:81:17

  - index.js:435 getDirParts
    [hello-world]/[chokidar]/index.js:435:31

  - index.js:442 FSWatcher._getWatchHelpers
    [hello-world]/[chokidar]/index.js:442:18

  - nodefs-handler.js:460 FSWatcher.NodeFsHandler._addToNodeFs
    [hello-world]/[chokidar]/lib/nodefs-handler.js:460:17

  - index.js:648 FSWatcher.<anonymous>
    [hello-world]/[chokidar]/index.js:648:12

  - index.js:16
    [hello-world]/[async-each]/index.js:16:7

  - Array.forEach

Environment

System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
Binaries:
Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 2.7.15
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^2.5.2 => 2.5.2

help wanted confirmed bug

Most helpful comment

For me the error is in this line :

const trueComponentPath = slash(truePath(page.component));

In the gatsby/dist/redux/actions/public.js

truePath returns undefined for my path '/Users/ssijak/work/hocudabudem.fit/src/pages/plaćanje-online.js', but it works with some other non-ascii letters in the url like'online-vođenje.js'
Also, I have upgraded all my dependencies today, and this was working before and now it does not.

P.S it fails on my osx machine, but it looks like that it does not fail on netlify build server which is running linux..

P.S.S the problem is this line in the library 'true-case-path' that Gatsby uses :
// OSX: HFS+ stores filenames in NFD (decomposed normal form) Unicode format, // so we must ensure that the input path is in that format first. if (process.platform === 'darwin') fsPathNormalized = fsPathNormalized.normalize('NFD')

Well, that was maybe the case 3 years ago when was the last time this library was updated. But in the meantime we got APFS on OSX and APFS does not normalize Unicode in filenames, so that line just screws things up on APFS and without it it works.
Can you remove this unmaintained library and just copy 2 lines from it that are needed, it should be a quick fix :)

All 12 comments

@SigmundurMorkore that's a recurring issue, not only the nordic special characters as for instance the portuguese and spanish ones as well, like for instance á,à,â,ã,ç or ñ

@jonniebigodes That does reaffirm my guess that all characters not in ASCII break Gatsby.

oh yeah, there are a few upstream issues but we can definitely fix this.

some more information here, same issue but with portuguese/spanish typed characters

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

Not sure how to attach a "not stale" label

There was a related fix in https://github.com/gatsbyjs/gatsby/pull/14372 - it looks like that change should be done for other gatsby packages that are still using slash.

basically we want this in gatsby/utils.js but we probably have to wait for gatsby v3

For me the error is in this line :

const trueComponentPath = slash(truePath(page.component));

In the gatsby/dist/redux/actions/public.js

truePath returns undefined for my path '/Users/ssijak/work/hocudabudem.fit/src/pages/plaćanje-online.js', but it works with some other non-ascii letters in the url like'online-vođenje.js'
Also, I have upgraded all my dependencies today, and this was working before and now it does not.

P.S it fails on my osx machine, but it looks like that it does not fail on netlify build server which is running linux..

P.S.S the problem is this line in the library 'true-case-path' that Gatsby uses :
// OSX: HFS+ stores filenames in NFD (decomposed normal form) Unicode format, // so we must ensure that the input path is in that format first. if (process.platform === 'darwin') fsPathNormalized = fsPathNormalized.normalize('NFD')

Well, that was maybe the case 3 years ago when was the last time this library was updated. But in the meantime we got APFS on OSX and APFS does not normalize Unicode in filenames, so that line just screws things up on APFS and without it it works.
Can you remove this unmaintained library and just copy 2 lines from it that are needed, it should be a quick fix :)

Just run into this issue by rebuilding an old site to gatsby. They have german umlauts like ä ö ü in their pathes. Creating page files containing öäü fails using gatsby develop. I am also developing on a MacOS with AFPS. Thanks @ssijak this helped me solving the problem!

this is still needed if gatsby wants to support non ASCII urls there is no current support for chinease or russian

Should be fixed in 2.17.17. Feel free to re-open with new details if it's not (and mention me)!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustinhorton picture dustinhorton  Â·  3Comments

andykais picture andykais  Â·  3Comments

theduke picture theduke  Â·  3Comments

dustinhorton picture dustinhorton  Â·  3Comments

jimfilippou picture jimfilippou  Â·  3Comments