Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

polymer init fails if project directory contains a space in the path #2503

Open nborelli opened 7 years ago

nborelli commented 7 years ago

Polymer CLI fails to init a project using any template - JSONError: Trailing comma in object. I have made sure I am running the latest of Node.js, NPM, Bower and the CLI.

Environment: Windows 10 64-bit Build 16063.483 Running commands from PowerShell Node version 8.2.1 NPM version 5.3.0 Bower version 1.8.0 Polymer-cli version 1.3.1

Error: cli runtime exception: JSONError: Trailing comma in object at 16:1 in ..\package.json

Console Output: PS D:\src\demos\Web Components\Polymer01> polymer init 'uname' is not recognized as an internal or external command, operable program or batch file. ? Which starter template would you like to use? polymer-2-element info: Running template polymer-2-element... error: cli runtime exception: JSONError: Trailing comma in object at 16:1 in ..\package.json } ^ error: JSONError: Trailing comma in object at 16:1 in ..\package.json } ^ at module.exports (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\parse-json\index.js:27:17) at parse (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\node_modules\load-json-file\index.js:8:29) at Function.module.exports.sync.fp [as sync] (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\node_modules\load-json-file\index.js:11:29) at Function.module.exports.sync (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\node_modules\read-pkg\index.js:40:25) at Function.module.exports.sync.opts [as sync] (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\node_modules\read-pkg-up\index.js:23:16) at ElementGenerator.Base.rootGeneratorVersion (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\lib\index.js:555:23) at ElementGenerator.Base._getGlobalStorage (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\lib\index.js:578:71) at ElementGenerator.module.exports (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\lib\index.js:139:29) at ElementGenerator (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\lib\init\element\element.js:35:13) at Environment.instantiate (C:\Users\Neal Borelli\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-environment\lib\environment.js:336:10)

nborelli commented 7 years ago

I think I just found the problem. It seems that if the directory path has a space in in anywhere, the Polymer CLI will fail to initialize the project. The confusing error message is what really threw me off!

Directory path was D:\src\demos\Web Components\Polymer01

Maybe the CLI can check for this and generate an error that spaces in the directory path are not allowed.

justinfagnani commented 7 years ago

Spaces should be allowed though, we should fix that.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.