FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

onboard validations to ensure that the respective package manager is installed #170

Closed jamesgeorge007 closed 4 years ago

jamesgeorge007 commented 4 years ago
$ create-snowpack-app  --template @snowpack/app-template-react --use-pnpm --target <path>
  - Using template @snowpack/app-template-react
  - Creating a new project in <path>
  - Installing package dependencies. This might take a couple of minutes.

(node:21818) UnhandledPromiseRejectionWarning: Error: Command failed with ENOENT: pnpm install --reporter=silent
spawn pnpm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:21818) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:21818) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
jamesgeorge007 commented 4 years ago

This might not seem necessary, why would a user opt for a package manager that he/she doesn't have on his/her machine. But it is always good to have all the possible cases covered. I would be happy to shoot a PR on receiving the green signal :+1:

FredKSchott commented 4 years ago

I think this is tougher than it sounds, especially across MS, Mac, Linux. I'd prefer to not take on this complexity, but I would love to show a better, human-readable error message here if it does not exist. Would you be interested in adding a PR for that?

jamesgeorge007 commented 4 years ago

IMO a better idea would be to fall back and consume npm rather than exiting the process.

FredKSchott commented 4 years ago

In my experience, of the user is asking for something specific and you can’t deliver, it’s better to error and let them resolve. Too easy to miss what’s happened, otherwise.