gridsome / gridsome/gridsome

Dynamic page routing with dynamic directories fails on Windows

Open
#1,359 5 comments 4 reactions 1 assignee Claimed by @hjvedvik View on GitHub
Dominant language
JavaScript
Stars
8.5k
Forks
466
PR merge metrics
No merged PRs in 30d

Description

## Description

On Windows, when running (`npm start`/`gridsome develop`) a gridsome project with dynamic routes (file based dynamic pages) where the path contains a variable in the middle (example below), path expansion fails and the whole script just crashes.

Example page path: `./src/pages/admin/users/[id]/Edit.vue`

### Steps to reproduce

1. Create a gridsome project ON WINDOWS.
0. Create a dynamic route where the parameter is at the middle (on a directory not on a file) for example: `./src/pages/something/[identifier]/action/SubAction.vue`.
0. Run the project in dev mode (`npm start`/`gridsome develop` or your favorite script config).

### Expected result

The script should run and the development server with hot reload should finish setting up and a website served on `http://localhost:8080`.

### Actual result

The script crashes with an error:

```
D:\Projects\node_modules\snapdragon\lib\parser.js:473
throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
^

Error: no parsers registered for: "]"
at parse (D:\Projects\node_modules\snapdragon\lib\parser.js:473:15)
at Parser.parse (D:\Projects\node_modules\snapdragon\lib\parser.js:477:24)
at Snapdragon.parse (D:\Projects\node_modules\snapdragon\index.js:122:28)
at Snapdragon. (D:\Projects\node_modules\braces\lib\braces.js:40:45)
at Braces.parse (D:\Projects\node_modules\braces\lib\braces.js:66:26)
at Braces.expand (D:\Projects\node_modules\braces\lib\braces.js:87:18)
at create (D:\Projects\node_modules\braces\index.js:142:15)
at memoize (D:\Projects\node_modules\braces\index.js:298:13)
at Function.braces.create (D:\Projects\node_modules\braces\index.js:165:10)
at Function.braces.expand (D:\Projects\node_modules\braces\index.js:81:17)
at getDirParts (D:\Projects\node_modules\gridsome\node_modules\chokidar\index.js:435:31)
at FSWatcher. (D:\Projects\node_modules\gridsome\node_modules\chokidar\index.js:452:24)
at D:\Projects\node_modules\gridsome\node_modules\readdirp\readdirp.js:220:72
at Array.filter ()
at D:\Projects\node_modules\gridsome\node_modules\readdirp\readdirp.js:220:12
at D:\Projects\node_modules\gridsome\node_modules\readdirp\readdirp.js:193:38
```

### Environment

```
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Binaries:
Node: 12.18.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
npmPackages:
@gridsome/source-filesystem: ^0.6.2 => 0.6.2
@gridsome/transformer-remark: ^0.6.1 => 0.6.3
gridsome: ^0.7.0 => 0.7.21
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.