Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"npx ignite-cli doctor" throws error if there is warn output before "npm list" command #1993

Closed
joshuayoes opened this issue Aug 4, 2022 · 3 comments · Fixed by #1998
Closed

Comments

@joshuayoes
Copy link
Contributor

What's going on?
When running npx ignite-cli doctor, if the npm logs a warning message in the packager.list output, it will throw an error.

Steps to reproduce

  1. Run npx ignite-cli doctor command on Windows. Some Windows users will have the following warn on npx or npm --global command, see StackOverflow article related to this.

npx ignite-cli doctor results:

npx ignite-cli doctor
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
System
  platform           win32       
  arch               x64         
  cpu                8 cores      Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz 
  directory          TodoApp      D:\Users\Work\Documents\Code\TodoApp      
C:\Users\Work\AppData\Local\npm-cache\_npx\e31027f3785124a8\node_modules\gluegun\build\index.js:13
    throw up;
    ^

SyntaxError: Unexpected token p in JSON at position 1
    at JSON.parse (<anonymous>)
    at C:\Users\Work\AppData\Local\npm-cache\_npx\e31027f3785124a8\node_modules\ignite-cli\build\tools\packager.js:205:33
    at C:\Users\Work\AppData\Local\npm-cache\_npx\e31027f3785124a8\node_modules\ignite-cli\build\tools\packager.js:281:54
    at step (C:\Users\Work\AppData\Local\npm-cache\_npx\e31027f3785124a8\node_modules\ignite-cli\build\tools\packager.js:44:23)       
    at Object.next (C:\Users\Work\AppData\Local\npm-cache\_npx\e31027f3785124a8\node_modules\ignite-cli\build\tools\packager.js:25:53)
    at fulfilled (C:\Users\Work\AppData\Local\npm-cache\_npx\e31027f3785124a8\node_modules\ignite-cli\build\tools\packager.js:16:58)  
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
@joshuayoes
Copy link
Contributor Author

I was able to log the value of the output passed to packager.list on my machine, it appears the warn is getting prepended to the JSON output, causing it throw:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
{
  "resolved": "file:../../Roaming/fnm/node-versions/v16.16.0/installation",
  "dependencies": {
    "corepack": {
      "version": "0.10.0"
    },
    "expo-cli": {
      "version": "6.0.1"
    },
    "npm": {
      "version": "8.11.0"
    }
  }
}

@jamonholmgren
Copy link
Member

Per zoom discussion, let's put this on hold and do the simpler version we chatted about (with the regression tests), and talk about the rest of the implementation post-Maverick.

infinitered-circleci pushed a commit that referenced this issue Aug 10, 2022
## [7.14.2](v7.14.1...v7.14.2) (2022-08-10)

### Bug Fixes

* **cli:** Handle "npm WARN" output in npm packager list command - fixes [#1993](#1993) ([#1998](#1998) by [@joshuayoes](https://github.com/joshuayoes)) ([07c1a01](07c1a01))
* **component:** Properly type Icon component icon prop as required ([#1976](#1976) by [@silasjmatson](https://github.com/silasjmatson)) ([524cb0d](524cb0d))
* **generator:** Added missing SnapshotIn import to model generator template ([#1986](#1986) by [@jojemapa](https://github.com/jojemapa)) ([d4d81ad](d4d81ad))
@infinitered-circleci
Copy link

🎉 This issue has been resolved in version 7.14.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants