lukeed / pwa

(WIP) Universal PWA Builder
https://pwa.cafe
3.13k stars 101 forks source link

PWA command not found on local install #55

Closed MVSICA-FICTA closed 5 years ago

MVSICA-FICTA commented 5 years ago

Would like to try PWA but I get the following from a local install:

$ pwa --help No command 'pwa' found, did you mean: Command 'paw' from package 'paw-common' (universe) Command 'pca' from package 'eigensoft' (multiverse) Command 'bwa' from package 'bwa' (universe) Command 'pda' from package 'speech-tools' (universe) Command 'pwd' from package 'coreutils' (main) Command 'pia' from package 'pia' (universe) Command 'poa' from package 'poa' (universe) Command 'pua' from package 'pglistener' (universe) pwa: command not found

lukeed commented 5 years ago

Hey, for that usage you have to install globally:

$ yarn global add @pwa/cli
# or
$ npm install -g @pwa/cli

A "local installation" means one that exists inside your project's node_modules directory. For example:

$ yarn add --dev @pwa/cli
# or 
$ npm install --save-dev @pwa/cli

... will add it to my-project/node_modules/.bin/pwa. At that point, you can do:

$ node node_modules/.bin/pwa --help

... or simply use pwa --help inside one of your package.json scripts (effectively, everything there automatically assumes the node node_modules/.bin prefix).

// package.json
{
  "scripts": {
    "hello": "pwa --help"
  },
  "devDependencies": {
    "@pwa/cli": "*"
  }
}
$ yarn hello
# or
$ npm run hello

None of this is specific to PWA – it's how Node.js handles all bin/exe scripts.

Hope that helps~! 😄

MVSICA-FICTA commented 5 years ago

Thanks! Just trying to keep it local where I can, will work with your perfectly clear options :)