ignite icon indicating copy to clipboard operation
ignite copied to clipboard

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

Open joshuayoes opened this issue 2 years ago • 2 comments

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 avatar Aug 04 '22 23:08 joshuayoes

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"
    }
  }
}

joshuayoes avatar Aug 04 '22 23:08 joshuayoes

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.

jamonholmgren avatar Aug 09 '22 23:08 jamonholmgren

:tada: This issue has been resolved in version 7.14.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

infinitered-circleci avatar Aug 10 '22 17:08 infinitered-circleci