vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.6k stars 4.76k forks source link

Path Quoting/Escaping Exception For Directories With Symbols And/Or Spaces #1202

Open Enteleform opened 5 years ago

Enteleform commented 5 years ago

Bug report

Version

0.14.8

Steps to reproduce

Create a path on a Windows 10 machine: C:\Some\Path\[2019-01-18] Some Project

Follow the Getting Started > Inside An Existing Project instructions from the VuePress documentation.

Execute the NPM script: docs:dev

What is expected?

The development server will start.

What is actually happening?

The following exception is thrown. It seems to be caused by a lack of path quoting and/or escaping, although I'm not sure whether that is happening within the VuePress codebase or somewhere along the dependency chain.

> 2019-01-18--clyphx-features@1.0.0 docs:dev D:\Projects\Proposals\[2019-01-18] ClyphX Features
> vuepress dev docs

 WAIT  Extracting site metadata...

Compiling

* Client █████████████████████████ compiling (0%)

D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\snapdragon\lib\parser.js:473
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
        ^

Error: no parsers registered for: "] Cly"
    at parse (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\snapdragon\lib\parser.js:473:15)
    at Parser.parse (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\snapdragon\lib\parser.js:477:24)
    at Snapdragon.parse (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\snapdragon\index.js:122:28)
    at Snapdragon.<anonymous> (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\lib\braces.js:40:45)
    at Braces.parse (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\lib\braces.js:66:26)
    at Braces.expand (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\lib\braces.js:87:18)
    at create (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\index.js:142:15)
    at memoize (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\index.js:298:13)
    at Function.braces.create (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\index.js:165:10)
    at Function.braces.expand (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\braces\index.js:81:17)
    at getDirParts (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\chokidar\index.js:435:31)
    at FSWatcher.<anonymous> (D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\chokidar\index.js:452:24)
    at D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\readdirp\readdirp.js:220:72
    at Array.filter (<anonymous>)
    at D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\readdirp\readdirp.js:220:12
    at D:\Projects\Proposals\[2019-01-18] ClyphX Features\node_modules\readdirp\readdirp.js:193:38
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 2019-01-18--clyphx-features@1.0.0 docs:dev: `vuepress dev docs`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 2019-01-18--clyphx-features@1.0.0 docs:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Fico\AppData\Roaming\npm-cache\_logs\2019-01-18T12_11_45_873Z-debug.log

Other relevant information

shigma commented 5 years ago

Can you provide a reproduction repo?

Enteleform commented 5 years ago

@Shigma The Getting Started page that I linked to from the official documentation literally just creates a "Hello World" bare-bones project. I can make a repo if you really need it, but the issue is pretty straightforward & will happen if you create a new VuePress project within a folder named [TimeStamp] Project Name and then run the vuepress dev docs command on a computer running Windows 10 (and possibly other OS's).

ulivz commented 5 years ago

I can make a repo if you really need it.

I hope you'll take a look at our issue template. Repro is a must for your problem.

Enteleform commented 5 years ago

Reproduction Repo:

https://github.com/enteleform-issues/VuePress--1202--Path-Quoting-Escaping-Exception

josensanchez commented 5 years ago

It happens to me in a Linux but without spaces in the directory name. just with the "]"

In my case is a PHP(Laravel) + Vue project which has a /vendor directory (something like node_modules but for composer) and it fails

~/vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/...

./PHPAPP_directory/node_modules/snapdragon/lib/parser.js:473
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');

Error: no parsers registered for: "]a(r)"

As the project already has all the documentation scattered into the source code with some API documents etc, I was trying to generate from the base directory of the project and use the docs directory for higher-level documents ... but this problem prevents me from having success.

I have no idea why anyone would want to name directories like this but ... unfortunately, it happens.

PS: It will be really useful to have the ability to ignore such dependencies directories, the same way as node_modules is ignored by default.