Initialize `package.json` if user hasn't already done so
kanadgupta opened this issue · 1 comments
kanadgupta commented
Current flow if user runs command from an empty directory:
➜ transit-api npx api install @metrotransit/v1.0#4xc4k3dl0mpgxoq
Need to install the following packages:
api
Ok to proceed? (y)
✔ What language would you like to generate an SDK for? › JavaScript
✔ How are your project imports and exports structured? › CommonJS
✔ Fetching your API
✔ Generating your SDK
✔ Saving your SDK into your codebase
⚠ This generator requires some packages to be installed alongside it:
› api: Required for the `api/dist/core` library that the codegen'd SDK uses for making requests. https://npm.im/api
› json-schema-to-ts: Required for TypeScript type handling. https://npm.im/json-schema-to-ts
› oas: Used within `api/dist/core` and is also loaded for TypeScript types. https://npm.im/oas
✔ OK to proceed with package installation? … yes
✖ Installing required packages
Command failed with exit code 254: npm install --save
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/kanadg/Code/readmeio/transit-api/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/kanadg/Code/readmeio/transit-api/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kanadg/.npm/_logs/2022-11-11T21_31_44_589Z-debug-0.log
kanadgupta commented
Confirmed that this is no longer an issue in the latest beta with npm@9.9.0
— maybe the NPM CLI fixed this?