PageSourceSearch

https://pnpm.io/assets/js/3d01e837.5825c203.js

js pnpm.io collected 2026-09-24 07:23:28 UTC 2,374 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["21707"],{93113(n,e,o){o.r(e),o.d(e,{metadata:()=>t,default:()=>d,frontMatter:()=>s,contentTitle:()=>a,toc:()=>c,assets:()=>p});var t=JSON.parse('{"id":"only-allow-pnpm","title":"Only allow pnpm","description":"When you use pnpm on a project, you don\'t want others to accidentally run","source":"@site/versioned_docs/version-10.x/only-allow-pnpm.md","sourceDirName":".","slug":"/only-allow-pnpm","permalink":"/10.x/only-allow-pnpm","draft":false,"unlisted":false,"editUrl":"https://github.com/pnpm/pnpm.io/edit/main/versioned_docs/version-10.x/only-allow-pnpm.md","tags":[],"version":"10.x","lastUpdatedBy":"Zoltan Kochan","lastUpdatedAt":1771892155000,"frontMatter":{"id":"only-allow-pnpm","title":"Only allow pnpm"}}'),l=o(91987),r=o(67008);let s={id:"only-allow-pnpm",title:"Only allow pnpm"},a,p={},c=[];function i(n){let e={code:"code",p:"p",pre:"pre",...(0,r.R)(),...n.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(e.p,{children:["When you use pnpm on a project, you don't want others to accidentally run\n",(0,l.jsx)(e.code,{children:"npm install"})," or ",(0,l.jsx)(e.code,{children:"yarn"}),". To prevent devs from using other package managers,\nyou can add the following ",(0,l.jsx)(e.code,{children:"preinstall"})," script to your ",(0,l.jsx)(e.code,{children:"package.json"}),":"]}),"\n",(0,l.jsx)(e.pre,{children:(0,l.jsx)(e.code,{className:"language-json",children:'{\n	"scripts": {\n		"preinstall": "npx only-allow pnpm"\n	}\n}\n'})}),"\n",(0,l.jsxs)(e.p,{children:["Now, whenever someone runs ",(0,l.jsx)(e.code,{children:"npm install"})," or ",(0,l.jsx)(e.code,{children:"yarn"}),", they'll get an\nerror instead and installation will not proceed."]}),"\n",(0,l.jsxs)(e.p,{children:["If you use npm v7, use ",(0,l.jsx)(e.code,{children:"npx -y"})," instead."]})]})}function d(n={}){let{wrapper:e}={...(0,r.R)(),...n.components};return e?(0,l.jsx)(e,{...n,children:(0,l.jsx)(i,{...n})}):i(n)}},67008(n,e,o){o.d(e,{R:()=>s,x:()=>a});var t=o(71763);let l={},r=t.createContext(l);function s(n){let e=t.useContext(r);return t.useMemo(function(){return"function"==typeof n?n(e):{...e,...n}},[e,n])}function a(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(l):n.components||l:s(n.components),t.createElement(r.Provider,{value:e},n.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.