ds300 / postinstall-postinstall Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
As noted in the README, this package runs the postinstall hook twice when yarn is run on your project.
The first time it is run, apparently standard out and standard in are swallowed. This is no doubt done to prevent confusion on the part of users of patch-package
, so they don't see reports of their patches being run twice.
However, I needed to add another script to my postinstall hook cause I needed to do patching in a different way than patch-package
does. My script happened to be idempotent, but I spent hours tearing my hair out because it was reporting that my patch had already been applied. How could the script be getting run twice? But it couldn't be getting run twice because if it were, it would be reporting both runs on the console, WOULDN'T IT???????
Finally I got to the README in this package. I had read the README of patch-package
, but hadn't bothered coming here.
I suggest that, if a better way cannot be found to convince yarn to run the postinstall hook on yarn remove
, that a note warning of this behavior should be added to the Why use postinstall-postinstall section of the patch-package
README.
Also, add a note to the fact that standard out and standard error are suppressed to this README.
i execute yarn add package
, it don't trigger. What i shoud do to trigger node ./run.js
?
Our project is using yarn and as such our CircleCI builds do not even have npm installed. Therefore, when installing and configuring patch-package, the build server errors even though patch-package is executed with --use-yarn.
[ERROR] Output:
[ERROR] /bin/sh: 1: npm: not found
[ERROR] child_process.js:644
[ERROR] throw err;
[ERROR] ^
[ERROR]
[ERROR] Error: Command failed: npm run prepare
[ERROR] /bin/sh: 1: npm: not found
[ERROR]
[ERROR] at checkExecSyncError (child_process.js:601:13)
[ERROR] at execSync (child_process.js:641:13)
[ERROR] at Object.<anonymous> (/workspace/app/ui/node_modules/postinstall-postinstall/run.js:14:5)
[ERROR] at Module._compile (module.js:652:30)
[ERROR] at Object.Module._extensions..js (module.js:663:10)
[ERROR] at Module.load (module.js:565:32)
[ERROR] at tryModuleLoad (module.js:505:12)
[ERROR] at Function.Module._load (module.js:497:3)
[ERROR] at Function.Module.runMain (module.js:693:10)
[ERROR] at startup (bootstrap_node.js:191:16)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.503 s
[INFO] Finished at: 2018-10-18T15:43:04Z
[INFO] Final Memory: 31M/102M
Looking at run.js, postinstall-postinstall (as well as postinstall-prepare) assume npm but neither have facility for using yarn instead.
Kind of related to #2 but the opposite.
The installation fails if there is no yarn
available.
yarn v1.22.10
running yarn add -D postinstall-postinstall
fails
error An unexpected error occurred: "ENOENT: no such file or directory, scandir '/path/to/my/node_modules/postinstall-postinstall'".
The current version of this package published to NPM is v2.1.0, but the latest package.json
in this repository shows v2.0.0.
Is the package published to NPM legitimate? If so, what are the changes in it?
Here is the log I get when I try to run yarn install
, yarn add
or node ./node_modules/postinstall-postinstall/run.js
:
I've tried to debug this and I've found out that spawnSync inside checkExecSyncError
returns an error. This causes checkExecSyncError
to return an error also. Workaround is replacing execSync
with exec
.
error ****/node_modules/postinstall-postinstall: Command failed.
Exit code: 1
Command: node ./run.js
Arguments:
Directory: ****/node_modules/postinstall-postinstall
Output:
error Command failed with exit code 1.
child_process.js:660
throw err;
^
Error: Command failed: yarn run postinstall
error Command failed with exit code 1.
at checkExecSyncError (child_process.js:621:11)
at execSync (child_process.js:657:15)
at Object.<anonymous> (****/node_modules/postinstall-postinstall/run.js:14:5)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.