-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
No way to opt out of post-install only #4100
Comments
still no way to do that? |
I have the same issue here, my use case is for Dockerfile. Here is the Dockerfile: FROM node:8 as builder
## Prepare dependencies
WORKDIR /app/
COPY package.json /app/
COPY yarn.lock /app/
RUN yarn --ignore-scripts
## Build
COPY . /app/
RUN yarn build I want to install the dependencies as a layer, then build the package later as another layer, just followed the Dockerfile best practice. And I don't want to execute I tried For my case, I have "scripts": {
"postinstall": "node lib/install.js",
"test": "xo && mocha"
}, So, what can I do if I just want to stop |
Deleted! |
Here's a workaround: "postinstall": "test -n \"$NOYARNPOSTINSTALL\" || yarn run build" You can now optionally prevent the postinstall script from running with: $ NOYARNPOSTINSTALL=1 yarn install |
No update on this? It has been over two years now... |
@ipmb so we drop cross-platform support? I guess windows-base OSes don't have |
I needed a cross-platform way to do this as well, so I made skip-postinstall {
"scripts": {
"postinstall": "skip-postinstall || node-gyp rebuild"
}
} SKIP_POSTINSTALL=1 yarn install |
If you want to run the postinstalls of dependencies but not your own you should just move that script out of your postinstall and invoke it manually whenever you need it to run
"Building fresh packages" is the postinstalls
Closing as fixed in v2 where you can run https://yarnpkg.com/getting-started/migration |
@merceyz, there is no even an option of |
It was renamed to |
@rajivshah3 I've been making use of your lightweight |
I want to disable a specific dependency's |
Here is my workaround: |
From my point of view "postinstall-script": "sh -c 'if [ -f ./dist/postinstall.js ]; then node ./dist/postinstall.js; fi'",
"postinstall": "sh -c 'if [ ! \"$<PROJECT_NAME>_NO_POST_INSTALL\" ]; then yarn postinstall-script; fi'" It depends on |
Easiest cross-platform way: "postinstall": "node -e \"process.env.NO_POSTINSTALL===1&&process.exit(1)\" || your-script" |
While
yarn install --ignore-scripts
ignores post-install scripts, it also prevents the Building fresh packages... stage of the install.How do I ignore post-install while keeping the building of fresh packages ?
Or how do I invoke building of fresh packages manually? I haven't found a command that does that.
The text was updated successfully, but these errors were encountered: