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

Does not seem to work with single package installs #1

Open
CxRes opened this issue Jun 27, 2020 · 6 comments
Open

Does not seem to work with single package installs #1

CxRes opened this issue Jun 27, 2020 · 6 comments

Comments

@CxRes
Copy link

CxRes commented Jun 27, 2020

I tried this with a new project and I get the following result. Please look especially at the npm i below:

PS D:\dev> npm run preinstall                                                                        
> @ preinstall D:\dev
> npx only-allow pnpm

npx: installed 26 in 8.997s
╔═════════════════════════════════════════════════════════════╗
║                                                             ║
║   Use "pnpm install" for installation in this project.      ║
║                                                             ║
║   If you don't have pnpm, install it via "npm i -g pnpm".   ║
║   For more details, go to https://pnpm.js.org/              ║
║                                                             ║
╚═════════════════════════════════════════════════════════════╝
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ preinstall: `npx only-allow pnpm`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\******\AppData\Roaming\npm-cache\_logs\2020-06-27T22_06_14_067Z-debug.log


PS D:\dev> npm i dotenv
npm notice created a lockfile as package-lock.json. You should commit this file.

+ [email protected]
added 425 packages from 258 contributors and audited 444 packages in 207.81s

75 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Versions:
node: 14.4.0
npm: 6.14.5
OS: Windows 10 x64

Perhaps you might like to look (or perhaps have already looked) at the thread here:
https://stackoverflow.com/questions/41076172/force-yarn-install-instead-of-npm-install-for-node-module/

@kenberkeley
Copy link

Please have a look at this comment in the thread mentioned above as well:

https://stackoverflow.com/questions/41076172/force-yarn-install-instead-of-npm-install-for-node-module/#comment112890527_62176124

kenberkeley added a commit to kenberkeley/set-up-a-typescript-fullstack-project-with-best-practices that referenced this issue Nov 15, 2020
@zkochan
Copy link
Member

zkochan commented Nov 16, 2020

The recommended way to use it is via npx:

{
  "scripts": {
    "preinstall": "npx only-allow pnpm"
  }
}

https://pnpm.js.org/en/only-allow-pnpm

kenberkeley added a commit to kenberkeley/set-up-a-typescript-fullstack-project-with-best-practices that referenced this issue Nov 16, 2020
@rhyek
Copy link

rhyek commented Jan 25, 2021

@zkochan I am doing exactly that and it's not working at any level (workspace root or specific package).

Eg: With the preinstall script in the workspace root allowing only pnpm I try the following:

❯ npm i uuid
+ [email protected]
added 134 packages from 86 contributors, removed 42 packages, updated 17 packages and audited 151 packages in 4.198s

23 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Node: 14.15.1
Npm: 6.14.11

@Venryx
Copy link

Venryx commented Jun 7, 2021

Same issue. The preinstall script is apparently not being run for single-package install commands, such as npm i uuid.

Here is an npm RFC on the subject: npm/rfcs#325

@Shinigami92
Copy link

@AliBahaari
Copy link

For me neither single package nor multiple not working.

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

No branches or pull requests

7 participants