Skip to content
  • Joey Perrott's avatar
    build: rely on engines to prevent using npm for dependency install (#41477) · c385e744
    Joey Perrott authored
    Rather than relying on a preinstall script, set `engine-strict` to `true` in a
    project `.npmrc` file, relying on the `engines` having `npm` set to note that
    yarn should be used instead.
    
    ---
    
    Output from `npm install` changes from:
    ```
    $ npm install
    
    > angular-srcs@12.0.0-next.7 preinstall /usr/local/account/js/angular
    > node tools/yarn/check-yarn.js
    
    /usr/local/account/js/angular/tools/yarn/check-yarn.js:12
      throw new Error(
      ^
    
    Error: Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/
        at Object.<anonymous> (/usr/local/account/js/angular/tools/yarn/check-yarn.js:12:9)
        at Module._compile (internal/modules/cjs/loader.js:778:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
        at Module.load (internal/modules/cjs/loader.js:653:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
        at Function.Module._load (internal/modules/cjs...
    c385e744