ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.58k stars 3.22k forks source link

only-allow: not found / MODULE_NOT_FOUND #9078

Closed PeterBenc closed 7 months ago

PeterBenc commented 8 months ago

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

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: only-allow@1.2.1
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: only-allow@1.2.1
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

Expected behavior

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

roninjin10 commented 8 months ago

@PeterBenc are you able to share a reproducible example? Link to the repo this is happening in or a minimal reproducible example?

PeterBenc commented 8 months ago

@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 commented 8 months ago

@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?

roninjin10 commented 8 months ago

What version of npm are you using?

acgith commented 7 months ago

We are having the same issue in ci when doing npm ci. It fails randomly >50% of the time.

alecananian commented 7 months ago

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.

roninjin10 commented 7 months ago

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

joaquim-verges commented 7 months ago

@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?

0xfrosty commented 6 months ago

Hey @roninjin10 , do you have an ETA for releasing this merge? Our pipelines fail most of the time because of this issue