optimism
optimism copied to clipboard
only-allow: not found / MODULE_NOT_FOUND
Opening the issue, not because I am convinced that the source of the problem is here, but just to let you guys know that there is such issue, and possible fix.
Describe the bug
- we are using
optimism-sdkas dependency - locally, all seem to work
- on circleCI or on heroku, the
yarn installcommand (seemingly randomly) fails with
Exit code: 127
Command: npx only-allow pnpm
Arguments:
Directory: /home/circleci/repo/node_modules/@eth-optimism/core-utils
Output:
npm WARN exec The following package was not found and will be installed: [email protected]
sh: 1: only-allow: not found
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Exited with code exit status 127
or
error /home/circleci/repo/node_modules/@eth-optimism/contracts-bedrock: Command failed.
Exit code: 1
Command: npx only-allow pnpm
Arguments:
Directory: /home/circleci/repo/node_modules/@eth-optimism/contracts-bedrock
Output:
npm WARN exec The following package was not found and will be installed: [email protected]
node:internal/modules/cjs/loader:1080
throw err;
^
Error: Cannot find module '/home/circleci/.npm/_npx/0b83cd9ca5e1325c/node_modules/.bin/only-allow'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.17.1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
To Reproduce
- hard to do, for us, the
yarn installscript was failing randomly, we haven't figured out what is it dependent on
Expected behavior
- yarn install works, only allow gets installed and is found
System Specs: "@eth-optimism/sdk": "^3.1.6"
Additional context Possibly related https://github.com/pnpm/only-allow/issues/11 https://github.com/npm/cli/issues/2660 https://github.com/Lightprotocol/light-protocol/issues/381 https://github.com/juliencrn/usehooks-ts/issues/420
Possible fix
- we added
only-allowpackage asdevDependencywhich seemed to fix the issue.
@PeterBenc are you able to share a reproducible example? Link to the repo this is happening in or a minimal reproducible example?
@roninjin10 sorry, no, I haven't been able to reproduce it, it just kept happening randomly in circleCI or in heroku. Its a private repo so cannot share more. Just posting the issue here, so you guys (and other in future) are aware that this happens.
@roninjin10 sorry, no, I haven't been able to reproduce it, it just kept happening randomly in circleCI or in heroku. Its a private repo so cannot share more. Just posting the issue here, so you guys (and other in future) are aware that this happens.
By randomly do you mean it sometimes would not happen sometimes would happen? Are you able to share the install command that this is failing on and/or more of the logging context this error happened on? Are you just running yarn install or something else?
What version of npm are you using?
We are having the same issue in ci when doing npm ci. It fails randomly >50% of the time.
Same here, fails on Vercel. The only-allow script likely shouldn't be added to these packages that can be installed by arbitrary consumers using npm, yarn, etc.
I will approve a pr opened that removes it. preinstall scripts aren’t supposed to ever run for npm packages so it’s odd that it’s causing issues
@roninjin10 thanks for merging #9805 !
we just recently added the dependency to the @thirdweb-dev/sdk package which is causing issues with yarn/npm for our users (this is what prompted @alecananian PR)
Any chance we can get #9812 merged today to get the latest release?
Hey @roninjin10 , do you have an ETA for releasing this merge? Our pipelines fail most of the time because of this issue