-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure when attempting to make patch #229
Comments
I've spent the better part of this morning digging into the code and it all comes back to something in the intersection of npm and node's spawnSync. Hazarding a guess I suspect it's a buffering issue similar to what I met in serverless-heaven/serverless-webpack#584, and described in nodejs/node#2926. Oh, and my current environment has changed to: I also forgot to mention that my .npmrc contains the following due to another problem I've fought with before, though I doubt this changes anything relevant:
|
Sure enough the same Linux-only hack made it work. Here's the hac.. ahem... patch that got things rolling again for me: diff --git a/node_modules/patch-package/dist/makePatch.js b/node_modules/patch-package/dist/makePatch.js
index 84275f2..10e9996 100644
--- a/node_modules/patch-package/dist/makePatch.js
+++ b/node_modules/patch-package/dist/makePatch.js
@@ -85,7 +85,7 @@ function makePatch(_a) {
try {
// try first without ignoring scripts in case they are required
// this works in 99.99% of cases
- spawnSafe_1.spawnSafeSync("npm", ["i"], {
+ spawnSafe_1.spawnSafeSync("script", ["-q", "/dev/null", "-c", "npm i", "/dev/null"], {
cwd: tmpRepoNpmRoot,
logStdErrOnError: false,
});
@@ -93,7 +93,7 @@ function makePatch(_a) {
catch (e) {
// try again while ignoring scripts in case the script depends on
// an implicit context which we havn't reproduced
- spawnSafe_1.spawnSafeSync("npm", ["i", "--ignore-scripts"], {
+ spawnSafe_1.spawnSafeSync("script", ["-q", "/dev/null", "-c", "npm i --ignore-scripts", "/dev/null"], {
cwd: tmpRepoNpmRoot,
});
} |
After digging even deeper there's another way to "fix" this that's fully cross-platform: diff --git a/node_modules/patch-package/dist/makePatch.js b/node_modules/patch-package/dist/makePatch.js
index 84275f2..a2547a6 100644
--- a/node_modules/patch-package/dist/makePatch.js
+++ b/node_modules/patch-package/dist/makePatch.js
@@ -88,6 +88,7 @@ function makePatch(_a) {
spawnSafe_1.spawnSafeSync("npm", ["i"], {
cwd: tmpRepoNpmRoot,
logStdErrOnError: false,
+ stdio: 'ignore',
});
}
catch (e) {
@@ -95,6 +96,7 @@ function makePatch(_a) {
// an implicit context which we havn't reproduced
spawnSafe_1.spawnSafeSync("npm", ["i", "--ignore-scripts"], {
cwd: tmpRepoNpmRoot,
+ stdio: 'ignore',
});
}
} Since STDERR and STDOUT were not able to be read on my system anyway this works well. Here's where I dug up that solution: nodejs/node-v0.x-archive#9057 |
I have same problem. Environment:
|
@landsman add the above patch to your |
Fixes ds300#229 using the working patch defined there.
The irony |
Same problem occurs no matter which package I attempt to make a patch for.
Ubuntu 18.04.3 LTS
Node and NPM installed via
resulting in
The text was updated successfully, but these errors were encountered: