yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.25k stars 1.08k forks source link

[Bug] Dependencies with noisy prepare scripts fail to install #1989

Open arseneyr opened 3 years ago

arseneyr commented 3 years ago

Describe the bug

Git dependencies with prepare scripts that output warnings/errors to stdout fail to install

To Reproduce

Reproduction --- [Playground](https://yarnpkg.com/playground?code=Y29uc3QgaW5zdGFsbFByb21pc2UgPSBwYWNrYWdlSnNvbkFuZEluc3RhbGwoew0KICBkZXBlbmRlbmNpZXM6IHsNCiAgICBbYHJlZHV4LXRodW5rYF06IGBodHRwczovL2dpdGh1Yi5jb20vcmVkdXhqcy9yZWR1eC10aHVuay5naXQjdjIuMy4wYCwNCiAgfSwNCn0pOw0KDQphd2FpdCBleHBlY3QoaW5zdGFsbFByb21pc2UpDQogIC5yZXNvbHZlcy50b0JlVHJ1dGh5KCk7DQo%3D) ```js repro const installPromise = packageJsonAndInstall({ dependencies: { [`redux-thunk`]: `https://github.com/reduxjs/redux-thunk.git#v2.3.0`, }, }); await expect(installPromise) .resolves.toBeTruthy(); ``` Output: ``` Error: expect(received).resolves.toBeTruthy() Received promise rejected instead of resolved Rejected to value: [Error: Command failed: /usr/local/bin/node /sandbox/berry/scripts/actions/../run-yarn.js install· ➤ YN0000: ┌ Resolution step ➤ YN0013: │ redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae can't be found in the cache and will be fetched from GitHub ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Installing the project using npm ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 prepare /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > npm run clean && npm run lint && npm run test && npm run build ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 clean /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > rimraf lib dist es ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 lint /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > eslint src test ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 test /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > cross-env BABEL_ENV=commonjs mocha --compilers js:babel-core/register --reporter spec test/*.js ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT thunk middleware ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return a function to handle next ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT handle next ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return a function to handle action ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT handle action ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must run the given action function with dispatch and getState ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must pass action to next if not a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return the return value of next if not a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return value as expected if a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must be invoked synchronously if a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT handle errors ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must throw if argument is non-object ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT withExtraArgument ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must pass the third argument ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT TypeScript definitions ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ should compile against index.d.ts (2091ms) ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT 10 passing (2s) ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 build /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > npm run build:commonjs && npm run build:umd && npm run build:umd:min && npm run build:es ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 build:commonjs /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > cross-env BABEL_ENV=commonjs babel src --out-dir lib ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT src/index.js -> lib/index.js ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 build:umd /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > cross-env BABEL_ENV=commonjs NODE_ENV=development webpack ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Hash: aa84e48162d2a5fe0af1 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Time: 288ms ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT redux-thunk.js 2.43 kB 0 [emitted] main ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 build:umd:min /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > cross-env BABEL_ENV=commonjs NODE_ENV=production webpack ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Hash: c9933422eb1206ce9978 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Time: 330ms ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT redux-thunk.min.js 692 bytes 0 [emitted] main ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-9b3f3d5c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > redux-thunk@2.3.0 build:es /tmp/xfs-b0145206 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT > cross-env BABEL_ENV=es babel src --out-dir es ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT src/index.js -> es/index.js ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): ➤ YN0000: │ /tmp/xfs-b0145206 STDERR npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) ➤ YN0000: │ /tmp/xfs-b0145206 STDERR· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT added 386 packages from 557 contributors and audited 456 packages in 14.465s ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT found 449 vulnerabilities (161 low, 2 moderate, 284 high, 2 critical) ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT run `npm audit fix` to fix them, or `npm audit` for details ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT thunk middleware ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return a function to handle next ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT handle next ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return a function to handle action ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT handle action ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must run the given action function with dispatch and getState ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must pass action to next if not a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return the return value of next if not a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must return value as expected if a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must be invoked synchronously if a function ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT handle errors ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must throw if argument is non-object ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT withExtraArgument ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ must pass the third argument ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT TypeScript definitions ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ✓ should compile against index.d.ts (1738ms) ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT 10 passing (2s) ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT· ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT src/index.js -> lib/index.js ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Hash: aa84e48162d2a5fe0af1 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Time: 293ms ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT redux-thunk.js 2.43 kB 0 [emitted] main ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Hash: c9933422eb1206ce9978 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Time: 343ms ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT redux-thunk.min.js 692 bytes 0 [emitted] main ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT src/index.js -> es/index.js ➤ YN0000: │ /tmp/xfs-b0145206 STDOUT redux-thunk-2.3.0.tgz ➤ YN0013: │ redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae can't be found in the cache and will be fetched from the remote repository ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Installing the project using npm ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 prepare /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > npm run clean && npm run lint && npm run test && npm run build ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 clean /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > rimraf lib dist es ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 lint /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > eslint src test ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 test /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > cross-env BABEL_ENV=commonjs mocha --compilers js:babel-core/register --reporter spec test/*.js ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT thunk middleware ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return a function to handle next ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT handle next ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return a function to handle action ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT handle action ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must run the given action function with dispatch and getState ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must pass action to next if not a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return the return value of next if not a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return value as expected if a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must be invoked synchronously if a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT handle errors ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must throw if argument is non-object ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT withExtraArgument ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must pass the third argument ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT TypeScript definitions ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ should compile against index.d.ts (2351ms) ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT 10 passing (3s) ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 build /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > npm run build:commonjs && npm run build:umd && npm run build:umd:min && npm run build:es ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 build:commonjs /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > cross-env BABEL_ENV=commonjs babel src --out-dir lib ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT src/index.js -> lib/index.js ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 build:umd /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > cross-env BABEL_ENV=commonjs NODE_ENV=development webpack ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Hash: aa84e48162d2a5fe0af1 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Time: 315ms ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT redux-thunk.js 2.43 kB 0 [emitted] main ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 build:umd:min /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > cross-env BABEL_ENV=commonjs NODE_ENV=production webpack ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Hash: c9933422eb1206ce9978 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Time: 377ms ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT redux-thunk.min.js 692 bytes 0 [emitted] main ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN lifecycle The node binary used for scripts is /tmp/xfs-d4bdf31a/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > redux-thunk@2.3.0 build:es /tmp/xfs-47400c86 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT > cross-env BABEL_ENV=es babel src --out-dir es ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT src/index.js -> es/index.js ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): ➤ YN0000: │ /tmp/xfs-47400c86 STDERR npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) ➤ YN0000: │ /tmp/xfs-47400c86 STDERR· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT added 386 packages from 557 contributors and audited 456 packages in 16.139s ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT found 449 vulnerabilities (161 low, 2 moderate, 284 high, 2 critical) ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT run `npm audit fix` to fix them, or `npm audit` for details ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT thunk middleware ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return a function to handle next ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT handle next ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return a function to handle action ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT handle action ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must run the given action function with dispatch and getState ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must pass action to next if not a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return the return value of next if not a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must return value as expected if a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must be invoked synchronously if a function ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT handle errors ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must throw if argument is non-object ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT withExtraArgument ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ must pass the third argument ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT TypeScript definitions ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ✓ should compile against index.d.ts (2891ms) ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT 10 passing (3s) ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT· ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT src/index.js -> lib/index.js ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Hash: aa84e48162d2a5fe0af1 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Time: 309ms ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT redux-thunk.js 2.43 kB 0 [emitted] main ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Hash: c9933422eb1206ce9978 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Version: webpack 1.15.0 ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Time: 453ms ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT Asset Size Chunks Chunk Names ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT redux-thunk.min.js 692 bytes 0 [emitted] main ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT [0] multi main 28 bytes {0} [built] ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT + 1 hidden modules ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT src/index.js -> es/index.js ➤ YN0000: │ /tmp/xfs-47400c86 STDOUT redux-thunk-2.3.0.tgz ➤ YN0001: │ Error: redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae: ENAMETOOLONG: name too long, rename '/tmp/xfs-47400c86/thunk middleware· ✓ must return a function to handle next handle next· ✓ must return a function to handle action handle action· ✓ must run the given action function with dispatch and getState· ✓ must pass action to next if not a function· ✓ must return the return value of next if not a function· ✓ must return value as expected if a function· ✓ must be invoked synchronously if a function handle errors· ✓ must throw if argument is non-object withExtraArgument· ✓ must pass the third argument TypeScript definitions· ✓ should compile against index.d.ts (2891ms)·· 10 passing (3s)· src/index.js -> lib/index.js Hash: aa84e48162d2a5fe0af1 Version: webpack 1.15.0 Time: 309ms Asset Size Chunks Chunk Names redux-thunk.js 2.43 kB 0 [emitted] main [0] multi main 28 bytes {0} [built] + 1 hidden modules Hash: c9933422eb1206ce9978 Version: webpack 1.15.0 Time: 453ms Asset Size Chunks Chunk Names redux-thunk.min.js 692 bytes 0 [emitted] main [0] multi main 28 bytes {0} [built] + 1 hidden modules src/index.js -> es/index.js redux-thunk-2.3.0.tgz' -> '/tmp/xfs-47400c86/package.tgz' ➤ YN0000: └ Completed in 53s 937ms ➤ YN0000: Failed with errors in 53s 938ms ] at expect (/sandbox/node_modules/expect/build/index.js:138:15) at module.exports (evalmachine.:8:7) at executeInTempDirectory (/sandbox/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:19) at executeInTempDirectory (/sandbox/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:22) at executeRepro (/sandbox/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:18) at module.exports../pages/api/sherlock.js.__webpack_exports__.default (/sandbox/.next/server/static/development/pages/api/sherlock.js:140:122) at Object.apiResolver (/sandbox/node_modules/next/dist/next-server/server/api-utils.js:46:15) at process._tickCallback (internal/process/next_tick.js:68:7) ``` ---

Environment if relevant (please complete the following information):

Additional context This is a result of using the output of npm pack --silent as the pack name: https://github.com/yarnpkg/berry/blob/97a66ff6b3ef0bc5a2ee6d0b502b6efc59a31298/packages/yarnpkg-core/sources/scriptUtils.ts#L227-L235

I'm confused as to why yarn tries to fetch the package twice, once with:

YN0013: │ redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae can't be found in the cache and will be fetched from GitHub

and the second time with

YN0013: │ redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae can't be found in the cache and will be fetched from the remote repository

Looks like the first npm pack even succeeded.

I'm not too familiar with the specifics of npm usage, but wouldn't just using <name>-<version>.tgz as the pack name suffice instead of parsing npm pack output? Or is there no easy way of getting that info? It seems risky to rely on dependencies to not have output in their prepare/prepack scripts.

yarnbot commented 3 years ago

This issue reproduces on master:

Error: expect(received).resolves.toBeTruthy()

Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install

➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0000: │ /tmp/xfs-59096c4c STDOUT Installing the project using npm
➤ YN0000: │ /tmp/xfs-59096c4c STDOUT 
➤ YN0000: │ /tmp/xfs-cf15031a STDOUT Installing the project using npm
➤ YN0000: │ /tmp/xfs-cf15031a STDOUT 
➤ YN0001: │ Error: redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
::endgroup::
➤ YN0000: └ Completed in 1s 27ms
➤ YN0000: Failed with errors in 1s 31ms
]
    at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-0ac41999f0.zip/node_modules/expect/build/index.js:138:15)
    at module.exports (evalmachine.<anonymous>:8:7)
    at /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:19
    at executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:22)
    at Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:18)
    at ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:59)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
joshhansen commented 3 years ago

We're getting this YN0001 error with ENAMETOOLONG on macOS. Yarn 2.4.2. The relevant yarn.lock for the mathjs dependency which is failing to build:

"mathjs@https://github.com/LearnSomethingTeam/mathjs.git#master":    
  version: 9.4.1
  resolution: "mathjs@https://github.com/LearnSomethingTeam/mathjs.git#commit=3c3048bedb39db7352bec75846ed6e8a04b9f862"
  dependencies:
    "@babel/runtime": ^7.14.0
    complex.js: ^2.0.13
    decimal.js: ^10.2.1
    escape-latex: ^1.2.0
    fraction.js: ^4.1.1
    javascript-natural-sort: ^0.7.1
    seedrandom: ^3.0.5
    tiny-emitter: ^2.1.0
    typed-function: ^2.0.0
  bin:                      
    mathjs: ./bin/cli.js
  checksum: cf51effe3de4295552f35476e6cf310885c8576f8bb8195d7824ba366a4d0b4df0f5e1eb1640ff2600697a7983839fe0ecd75a158ae72c745e1049a341cc7e06
  languageName: node
  linkType: hard

Screenshot of relevant error output, can get you full output if needed:

image

The maximum filename length on this HFS+ filesystem was determined to be 255 by manual testing; for path length we have not observed a limit (should be unlimited as per this).

We also had this sort checksum failure which we worked around with YARN_CHECKSUM_BEHAVIOR=update. IIRC that also involved that mathjs dependency.

More details can be provided upon request.

arcanis commented 3 years ago

Hard to say, but from a quick look it almost looks like the gulp output somehow finished inside the final name. Note how .../xfs-7685cad0/ is immediately followed by what I guess is the gulp output: [19:39:...

joshhansen commented 3 years ago

The Gulp build itself appears to finish successfully, but Yarn seems to "remember" the ENAMETOOLONG and declare the build a failure anyway.

Perhaps the YN0001 log message is missing a newline at the end? Or if Gulp is running in another process its output could be interrupting the output of the main process, but in that case you'd expect to see an extra linebreak somewhere.

Can anybody reproduce this? Should be possible on macOS attempting to build that mathjs repository.

Here's a text version of the complete output:

Mugsys-MacBook-Air:learnSomething mugsycarter$ yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @vue/babel-plugin-jsx@npm:1.0.6 doesn't provide @babel/core (p93619), requested by @babel/plugin-syntax-jsx
➤ YN0002: │ client@workspace:client doesn't provide @babel/core (p3e24d), requested by babel-preset-airbnb
➤ YN0002: │ client@workspace:client doesn't provide @babel/runtime (pcca5c), requested by babel-preset-airbnb
➤ YN0060: │ client@workspace:client provides vue (pea813) with version 3.0.11, which doesn't satisfy what vuetify requests
➤ YN0002: │ client@workspace:client doesn't provide webpack (pe6bc8), requested by sass-loader
➤ YN0002: │ learnsomething@workspace:. doesn't provide @babel/core (p7de45), requested by @babel/preset-typescript
➤ YN0002: │ learnsomething@workspace:. doesn't provide eslint-plugin-jsx-a11y (pbe8c3), requested by eslint-config-airbnb
➤ YN0002: │ learnsomething@workspace:. doesn't provide eslint-plugin-react (p011ab), requested by eslint-config-airbnb
➤ YN0002: │ learnsomething@workspace:. doesn't provide eslint-plugin-react-hooks (p1b49b), requested by eslint-config-airbnb
➤ YN0002: │ vue-cli-plugin-vuetify@npm:2.3.1 [65614] doesn't provide webpack (paa869), requested by null-loader
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 3s 613ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs@npm:15.4.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yn@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yorkie@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ mathjs@https://github.com/LearnSomethingTeam/mathjs.git#commit=3c3048bedb39db7352bec75846ed6e8a04b9f862 ca
➤ YN0001: │ Error: mathjs@https://github.com/LearnSomethingTeam/mathjs.git#commit=3c3048bedb39db7352bec75846ed6e8a04b9f862: ENAMETOOLONG: name too long, rename '/private/var/folders/5f/_q1g3bms7ks83_vj2h28pwmm0000gn/T/xfs-082cff0f/[14:33:28] Using gulpfile /private/var/folders/5f/_q1g3bms7ks83_vj2h28pwmm0000gn/T/xfs-082cff0f/gulpfile.cjs
[14:33:28] Starting 'default'...
[14:33:28] Starting 'clean'...
[14:33:29] Finished 'clean' after 718 ms
[14:33:29] Starting 'updateVersionFile'...
[14:33:29] Finished 'updateVersionFile' after 1.32 ms
[14:33:29] Starting 'compileCommonJs'...
[14:33:53] Finished 'compileCommonJs' after 24 s
[14:33:53] Starting 'generateEntryFiles'...
[14:33:54] Finished 'generateEntryFiles' after 1.25 s
[14:33:54] Starting 'compileEntryFiles'...
[14:34:01] Finished 'compileEntryFiles' after 7 s
[14:34:01] Starting 'compileESModules'...
[14:34:36] Finished 'compileESModules' after 35 s
[14:34:36] Starting 'writeCompiledHeader'...
[14:34:36] Finished 'writeCompiledHeader' after 7.91 ms
[14:34:36] Starting 'bundle'...
[14:35:08] bundled /private/var/folders/5f/_q1g3bms7ks83_vj2h28pwmm0000gn/T/xfs-082cff0f/lib/browser/math.js
[14:35:08] Finished 'bundle' after 32 s
[14:35:08] Starting 'generateDocs'...
[14:35:09] Finished 'generateDocs' after 402 ms
[14:35:09] Finished 'default' after 1.67 min
mathjs-9.4.1.tgz' -> '/private/var/folders/5f/_q1g3bms7ks83_vj2h28pwmm0000gn/T/xfs-082cff0f/package.tgz'
➤ YN0000: └ Completed in 10m 52s
➤ YN0000: Failed with errors in 10m 56s
arcanis commented 3 years ago

I can't try right now but the issue is even clearer with the full logs: somehow your npm is outputting things during npm pack despite the --silent flag. This is what causes the build logs to be included within the filename ... 🤔

Cf https://github.com/yarnpkg/berry/blob/ef91d772209329db32bbf3383918da9b0258306d/packages/yarnpkg-core/sources/scriptUtils.ts#L273-L277

jdelStrother commented 2 years ago

I think this was maybe fixed in 3.1 - https://github.com/yarnpkg/berry/pull/3303

merceyz commented 2 years ago

Running Sherlock again to check

yarnbot commented 2 years ago

This issue reproduces on master:

Error: expect(received).resolves.toBeTruthy()

Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install

➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0000: │ /tmp/xfs-3a0fb5a4 STDOUT Packing redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae from sources
➤ YN0000: │ /tmp/xfs-3a0fb5a4 STDOUT Using npm for bootstrap. Reason: found npm's "package-lock.json" lockfile
➤ YN0000: │ /tmp/xfs-3a0fb5a4 STDOUT 
➤ YN0000: │ /tmp/xfs-ad4d2e16 STDOUT Packing redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae from sources
➤ YN0000: │ /tmp/xfs-ad4d2e16 STDOUT Using npm for bootstrap. Reason: found npm's "package-lock.json" lockfile
➤ YN0000: │ /tmp/xfs-ad4d2e16 STDOUT 
➤ YN0001: │ Error: redux-thunk@https://github.com/reduxjs/redux-thunk.git#commit=4ea70e9196b0388c8527e26bde4e4d2659252bae: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
::endgroup::
➤ YN0000: └ Completed in 0s 857ms
➤ YN0000: Failed with errors in 0s 861ms
]
    at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-0c0da74930.zip/node_modules/expect/build/index.js:138:15)
    at module.exports (evalmachine.<anonymous>:8:7)
    at /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:19
    at executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:22)
    at Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:18)
    at ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:59)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
Lonli-Lokli commented 2 years ago

Is there any workaround? Or least possibility to know what causing this? I am getting

PS D:\gitlab\cv-app\frontend\cv-ui> yarn prettier
Internal Error: spawn ENAMETOOLONG
    at ChildProcess.spawn (internal/child_process.js:405:11)
    at spawn (child_process.js:677:9)
    at Object.spawnWithSignal [as spawn] (child_process.js:911:17)
    at g1 (D:\gitlab\cv-app\frontend\cv-ui\.yarn\releases\yarn-3.2.0.cjs:4:7429)
    at Ud.implementation (D:\gitlab\cv-app\frontend\cv-ui\.yarn\releases\yarn-3.2.0.cjs:396:18472)
re-taro commented 1 year ago

I've hit a familiar bug with it too.

PS D:\dev\2022-HP> yarn lint
Internal Error: spawn ENAMETOOLONG
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at Object.spawn (node:child_process:713:9)
    at VM (D:\dev\2022-HP\.yarn\releases\yarn-3.2.3.cjs:4:7429)
    at Kd.implementation (D:\dev\2022-HP\.yarn\releases\yarn-3.2.3.cjs:392:18472)
    at Kd.exec (D:\dev\2022-HP\.yarn\releases\yarn-3.2.3.cjs:395:1583)
    at Kd.run (D:\dev\2022-HP\.yarn\releases\yarn-3.2.3.cjs:395:1754)
    at e9 (D:\dev\2022-HP\.yarn\releases\yarn-3.2.3.cjs:401:6555)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async KPe (D:\dev\2022-HP\.yarn\releases\yarn-3.2.3.cjs:403:16)
Lonli-Lokli commented 1 year ago

I really do not know what is the reason but it happens only with yarn (v3.4.1) "format": "run-s prettier lint:fix",

yarn format - fails npm run format - success

XDoubleU commented 1 year ago

I am using yarn v3.5.0 and also have this issue when executing prettier --write ./**/*.{ts,tsx} using yarn

dcrockett-aspen commented 1 year ago

@XDoubleU I ran into this same issue when migrating a project from yarn classic to yarn 3.5 with our package.json lint command using eslint. Try adding single quotes around the file glob pattern. I am not sure why it is causing issues but this fixed the problem we were having. Ex: prettier --write './**/*.{ts,tsx}'

mfb-davidmay commented 1 year ago

@XDoubleU I ran into this same issue when migrating a project from yarn classic to yarn 3.5 with our package.json lint command using eslint. Try adding single quotes around the file glob pattern. I am not sure why it is causing issues but this fixed the problem we were having. Ex: prettier --write './**/*.{ts,tsx}'

GODSEND ... adding the quotes is exactly what was causing yarn to throw the Internal Error: spawn ENAMETOOLONG which is probably why prettier is dying as well!

ilharp commented 4 months ago

Confirmed that surrounding the glob with single quotes solves this problem on v4.1.0.

-"lint": "eslint --ignore-path .gitignore --ignore-pattern **/*.d.ts ."
+"lint": "eslint --ignore-path .gitignore --ignore-pattern '**/*.d.ts' ."