swagger-api / swagger-node

Swagger module for node.js
http://swagger.io
Apache License 2.0
3.97k stars 584 forks source link

Project generator doesn't work #545

Open georgyfarniev opened 6 years ago

georgyfarniev commented 6 years ago

Hello. I'm just starting with swagger, installed latest version of swagger, and I get the following:

$ swagger project create hello-world
? Framework? (Use arrow keys)
> connect
  express
  hapi
  restify
  sails SyntaxError: Invalid regular expression: /.{1,0}/: numbers out of order in {} quantifier
    at new RegExp (<anonymous>)
    at breakLines (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\utils\screen-manager.js:108:15)
    at module.exports.ScreenManager.render (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\utils\screen-manager.js:55:22)
    at Prompt.render (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\prompts\list.js:103:15)
    at Prompt._run (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\prompts\list.js:74:8)
    at Prompt.run (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\prompts\base.js:57:8)
    at Object.<anonymous> (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\ui\prompt.js:84:12)
    at module.exports (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\run-async\index.js:15:21)
    at AnonymousObservable.__subscribe (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\inquirer\lib\utils\utils.js:16:7)
    at AnonymousObservable.tryCatcher (C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\rx-lite\rx.lite.js:63:31)
$ node --version
v9.4.0
$ npm --version
5.6.0

Platform: Windows 10 64-bit

Also, got the following errors during swagger installation:

 npm install -g swagger
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated URIjs@1.16.1: package renamed to "urijs" (lower-case), please update accordingly
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg= integrity checksum failed when using sha1: wanted sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg= but got sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==. (2301 bytes)
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
C:\Users\georgy\AppData\Roaming\npm\swagger -> C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\bin\swagger.js
C:\Users\georgy\AppData\Roaming\npm\swagger-project -> C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\bin\swagger-project.js

> nodemon@1.14.12 postinstall C:\Users\georgy\AppData\Roaming\npm\node_modules\swagger\node_modules\nodemon
> node -e "console.log('\u001b[32mLove nodemon? You can now support the project via the open collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/nodemon/donate\u001b[0m\n')" || exit 0

Love nodemon? You can now support the project via the open collective:
 > https://opencollective.com/nodemon/donate

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\swagger\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ swagger@0.7.5

Possibly related to minimatch?

macmacs commented 6 years ago

Exactly the same problem here. Same Setup.

georgyfarniev commented 6 years ago

I tried to install swagger as local package and just updated all dependencies manually, it worked for me. So please update dependencies in NPM package.

TheSerumDev commented 6 years ago

How to update it ?

kjr247 commented 5 years ago

I believe this issue is a duplicate of both "swagger project create fails with SyntaxError: Invalid regular expression" and "SyntaxError: Invalid regular expression" https://github.com/swagger-api/swagger-node/issues/518 https://github.com/swagger-api/swagger-node/issues/315

Problem was on windows and "swagger project create -f express file-name"

worked for me.