Open motss opened 2 years ago
Thanks for the detailed report, seems like an issue with package.json
resolver. Gonna look into it on weekends
similar error while deploying to google app engine
Running "yarn install --non-interactive --prefer-offline --modules-folder=/layers/google.nodejs.yarn/yarn_modules/node_modules --frozen-lockfile (PATH=/layers/google.nodejs.yarn/yarn_engine/bin:/layers/google.nodejs.runtime/node/bin:/builder/google-cloud-sdk/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/layers/google.nodejs.yarn/yarn_modules/node_modules/.bin)"
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > ts-loader@9.4.1" has unmet peer dependency "webpack@^5.0.0".
[4/4] Building fresh packages...
error /layers/google.nodejs.yarn/yarn_modules/node_modules/simple-git-hooks: Command failed.
Exit code: 1
Command: node ./postinstall.js
Arguments:
Directory: /layers/google.nodejs.yarn/yarn_modules/node_modules/simple-git-hooks
Output:
node:internal/fs/utils:347
throw err;
^
Error: ENOENT: no such file or directory, stat '/layers/google.nodejs.yarn/yarn_modules/package.json'
at Object.statSync (node:fs:1588:3)
at _getPackageJson (/layers/google.nodejs.yarn/yarn_modules/node_modules/simple-git-hooks/simple-git-hooks.js:174:13)
at checkSimpleGitHooksInDependencies (/layers/google.nodejs.yarn/yarn_modules/node_modules/simple-git-hooks/simple-git-hooks.js:102:34)
at postinstall (/layers/google.nodejs.yarn/yarn_modules/node_modules/simple-git-hooks/postinstall.js:15:9)
at Object.<anonymous> (/layers/google.nodejs.yarn/yarn_modules/node_modules/simple-git-hooks/postinstall.js:24:1)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/layers/google.nodejs.yarn/yarn_modules/package.json'
}
Similar error when calling npx simple-git-hooks
from Windows cmd
prompt if you don't have it installed locally or globally already and you're on npx
version 6.:
C:\Code\my-code>npx simple-git-hooks
internal/fs/utils.js:332
throw err;
^
Error: ENOENT: no such file or directory, stat 'C:\Users\me\AppData\Roaming\npm-cache\_npx\9096\package.json'
at Object.statSync (fs.js:1132:3)
at _getPackageJson (C:\Users\me\AppData\Roaming\npm-cache\_npx\9096\node_modules\simple-git-hooks\simple-git-hooks.js:190:13)
at checkSimpleGitHooksInDependencies (C:\Users\me\AppData\Roaming\npm-cache\_npx\9096\node_modules\simple-git-hooks\simple-git-hooks.js:113:34)
at postinstall (C:\Users\me\AppData\Roaming\npm-cache\_npx\9096\node_modules\simple-git-hooks\postinstall.js:18:9)
at Object.<anonymous> (C:\Users\me\AppData\Roaming\npm-cache\_npx\9096\node_modules\simple-git-hooks\postinstall.js:27:1)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
errno: -4058,
syscall: 'stat',
code: 'ENOENT',
path: 'C:\\Users\\me\\AppData\\Roaming\\npm-cache\\_npx\\9096\\package.json'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! simple-git-hooks@2.9.0 postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the simple-git-hooks@2.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\me\AppData\Roaming\npm-cache\_logs\2023-08-18T22_04_12_642Z-debug.log
Install for [ 'simple-git-hooks@latest' ] failed with code 1
It doesn't seem to happen with newer versions of npx
though.
Any updates?
Any updates?
I havent worked on this specific issue. Do you happen to encounter the same bug?
Any updates?
I havent worked on this specific issue. Do you happen to encounter the same bug?
Yes, This is the only way I can set it up to prevent pipeline interruptions "prepare": "npx simple-git-hooks || true"
Yes, This is the only way I can set it up to prevent pipeline interruptions
"prepare": "npx simple-git-hooks || true"
Hey, can you please share some info on environment? Do you have package.json
file in pipeline?
In the meantime... I think I'll cook a way to make script fail silently if package.json is not found..
Yes, This is the only way I can set it up to prevent pipeline interruptions
"prepare": "npx simple-git-hooks || true"
Hey, can you please share some info on environment? Do you have
package.json
file in pipeline?In the meantime... I think I'll cook a way to make script fail silently if package.json is not found..
my host machine is running on node v14.21.3 (npm v6.14.18),
my pipline flow looks something like this, "prepare": "npx simple-git-hooks || true", "prepublishOnly": "pnpm install && pnpm build"
npx simple-git-hooks will execute before pnpm install, and I can replicate this on my mac;
Thanks for the info!
Can you please provide one small detail: script crashes because it couldn't find package.json file.. Do you have package.json
file inside your file system in your pipeline?
Thanks for the info!
Can you please provide one small detail: script crashes because it couldn't find package.json file.. Do you have
package.json
file inside your file system in your pipeline?
Yes It exists, otherwise npm hooks will not execute.
Issues
Running
simple-git-hooks
withnpx
ornpm exec
causes the installation to fail.Expected behavior
simple-git-hooks
should run correctly usingnpx
ornpm exec
locally.Actual behavior
Running
npx -y simple-git-hooks
ornpm exec -y -- simple-git-hooks@latest
throws error.Debugging details