creditcard.js icon indicating copy to clipboard operation
creditcard.js copied to clipboard

Installation with npm fails (again)

Open dtillner opened this issue 1 year ago • 1 comments

With version 3.0.30 installation with npm fails with error "yarn not found".

Probably this is because of this line in package.json

"preinstall": "yarn dlx only-allow yarn",

Reintroduced problem from #159

dtillner avatar Mar 07 '24 15:03 dtillner

Version 3.0.33 still failing when installing with npm with the yarn not found error.

It's possible to install if you're using bun as package manager, but had to rip it off as of now because deployments kept failing since I'm kinda locked with npm on production.

yuigoto avatar Jun 20 '24 21:06 yuigoto

This was done in a minor point release, but is a definite breaking change, and should have bumped to a more major version.

eigood avatar Aug 27 '25 22:08 eigood

No it should not have been committed at all. It makes absolutely no sense to limit this package to yarn.

As @cirocfc already stated https://github.com/ContaAzul/creditcard.js/issues/159#issuecomment-1439076861 this was committed accidently from internal packages.

But it doesn't matter anyways because this repository seems to be dead.

dtillner avatar Aug 28 '25 17:08 dtillner

Hey guys!

Sorry we've been absent. This project doesn't really need much attention inside the company as the code works perfectly inside our software. I get that it is used in many other projects and I try to help when I can. From what've seen and remember, the code shipped to npm has the hooks disabled. Are you guys still having problems?

https://www.npmjs.com/package/creditcard.js?activeTab=code

Image

cirocfc avatar Sep 02 '25 14:09 cirocfc

Yes, still having problems. I don't think those underscores do what you think they do.

npm install --verbose [email protected]
...
npm info run [email protected] preinstall node_modules/creditcard.js yarn dlx only-allow yarn
...
npm info run [email protected] preinstall { code: 1, signal: null }
npm verbose stack Error: command failed
npm verbose stack     at promiseSpawn (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:22:22)
npm verbose stack     at spawnWithShell (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:124:10)
npm verbose stack     at promiseSpawn (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:12:12)
npm verbose stack     at runScriptPkg (/usr/local/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js:77:13)
npm verbose stack     at runScript (/usr/local/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js:9:12)
npm verbose stack     at /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:329:17
npm verbose stack     at run (/usr/local/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:67:22)
npm verbose stack     at /usr/local/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:84:9
npm verbose stack     at new Promise ()
npm verbose stack     at callLimit (/usr/local/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:35:69)
npm verbose pkgid [email protected]
npm error code 1
npm error path /srv/app/node_modules/creditcard.js
npm error command failed
npm error command sh -c yarn dlx only-allow yarn
npm error error This project's package.json defines "packageManager": "[email protected]". However the current global version of Yarn is 1.22.22.
npm error
npm error Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
npm error Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
npm verbose cwd /srv/app
npm verbose os Linux 6.1.0-15-amd64
npm verbose node v22.9.0
npm verbose npm  v10.8.3

eigood avatar Sep 02 '25 16:09 eigood

Seems like npm changed a bit and even with the underscore the lifecycle scripts was executing. Then they changed the manifest.json part as well. If you check the tarball it doesn't have a postinstall script, but the manifest.json had it. So I changed the lifecycle scripts and now it's working again. Sorry about that. https://github.com/npm/cli/issues/7322

Fixed version: https://github.com/ContaAzul/creditcard.js/releases/tag/v3.0.39

cirocfc avatar Sep 11 '25 12:09 cirocfc