swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

Generating api file is not working

Open pavelDruzhinin opened this issue 4 years ago • 1 comments

Hi all.

I run npx command to generate api.ts file and getting an error: Unexpected token =

Full npx command: npx swagger-typescript-api -p https://localhost:5001/swagger/v1/swagger.json --axios -o ./src/utils/ -n api.ts

log: 0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'run', 1 verbose cli 'api:update:local' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'preapi:update:local', 4 verbose run-script 'api:update:local', 4 verbose run-script 'postapi:update:local' ] 5 info lifecycle [email protected]~preapi:update:local: [email protected] 6 info lifecycle [email protected]~api:update:local: [email protected] 7 verbose lifecycle [email protected]~api:update:local: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~api:update:local: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/paveldruzinin/Projects/project-name/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin 9 verbose lifecycle [email protected]~api:update:local: CWD: /Users/paveldruzinin/Projects/project-name 10 silly lifecycle [email protected]~api:update:local: Args: [ '-c', 10 silly lifecycle 'npx swagger-typescript-api -p https://localhost:5001/swagger/v1/swagger.json --axios -o ./src/utils/ -n api.ts' ] 11 silly lifecycle [email protected]~api:update:local: Returned: code: 1 signal: null 12 info lifecycle [email protected]~api:update:local: Failed to exec api:update:local script 13 verbose stack Error: [email protected] api:update:local: npx swagger-typescript-api -p https://localhost:5001/swagger/v1/swagger.json --axios -o ./src/utils/ -n api.ts13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16) 13 verbose stack at EventEmitter.emit (events.js:182:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:182:13) 13 verbose stack at maybeClose (internal/child_process.js:962:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5) 14 verbose pkgid [email protected] 15 verbose cwd /Users/paveldruzinin/Projects/project-name 16 verbose Darwin 20.3.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "api:update:local" 18 verbose node v10.14.2 19 verbose npm v6.9.0 20 error code ELIFECYCLE 21 error errno 1 22 error [email protected] api:update:local:npx swagger-typescript-api -p https://localhost:5001/swagger/v1/swagger.json --axios -o ./src/utils/ -n api.ts 22 error Exit status 1 23 error Failed at the [email protected] api:update:local script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

It worked yesterday. I also checked a swagger file. it exists and available. Please, help me

pavelDruzhinin avatar May 21 '21 10:05 pavelDruzhinin

Hello @pavelDruzhinin !
Did you try to use npx [email protected] ... ?

js2me avatar May 21 '21 14:05 js2me