$ git clone https://github.com/taiga-family/taiga-ui.git
$ cd taiga-ui
$ npm ci
$ npx -y knip
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'typescript' imported from /Users/m.ivanov4/.npm/_npx/8d873e0e769cf1b4/node_modules/knip/dist/PrincipalFactory.js
at new NodeError (node:internal/errors:405:5)
at packageResolve (node:internal/modules/esm/resolve:887:9)
at moduleResolve (node:internal/modules/esm/resolve:936:20)
at defaultResolve (node:internal/modules/esm/resolve:1129:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v18.17.1
One where
npx knipworks standalone, of course š@splincode @webpro I ran into the same issue, in my case it helped to use a different typescript version than my version that was locally installed.
npx -p typescript@latest -p knip knipš This issue has been resolved in v5.4.0. See Release 5.4.0 for release notes.
Doesnāt
--legacy-peer-depsmean no peer deps get auto installed, and therefore that break is expected?I think the global install is depending on whatever people happen to have gotten into their global caches, which is unfortunate and I didnāt realize that
npxwould not be properly installing peer deps.(Then again, itās a little odd to use
knipglobally, becuase I would expect that my workspace typescript be used, not some random version set byknip).Thanks for reporting this. Knip requires peer dependencies
typescriptand@types/nodeand Iām not sure whynpxfails to find or install those.Not sue how to reproduce. When I try this and
knipis not globally available (i.e.kniporwhich kniperr and nothing innpm ls -ghaskniplisted etc.), āit works on my machineā. Maybe itās an old/specific version of npm?You could try
pnpm dlx kniporbunx kniptoo as a workaround.