How to disable yarn interactive prompt for yarn upgrade
I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.
yarn upgrade mypackage@5.9.5
But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:
Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)
This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.
Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?
node.js bash yarnpkg
add a comment |
I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.
yarn upgrade mypackage@5.9.5
But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:
Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)
This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.
Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?
node.js bash yarnpkg
You could experiment with I/O redirection withyarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the--non-interactiveflag happens to work withupgradethough it is not documented as such.
– user268396
Jan 18 at 23:03
add a comment |
I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.
yarn upgrade mypackage@5.9.5
But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:
Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)
This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.
Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?
node.js bash yarnpkg
I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.
yarn upgrade mypackage@5.9.5
But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:
Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)
This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.
Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?
node.js bash yarnpkg
node.js bash yarnpkg
edited Jan 18 at 22:55
tk421
3,40231426
3,40231426
asked Jan 18 at 15:58
DmitriDmitri
9,22182546
9,22182546
You could experiment with I/O redirection withyarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the--non-interactiveflag happens to work withupgradethough it is not documented as such.
– user268396
Jan 18 at 23:03
add a comment |
You could experiment with I/O redirection withyarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the--non-interactiveflag happens to work withupgradethough it is not documented as such.
– user268396
Jan 18 at 23:03
You could experiment with I/O redirection with
yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.– user268396
Jan 18 at 23:03
You could experiment with I/O redirection with
yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.– user268396
Jan 18 at 23:03
add a comment |
1 Answer
1
active
oldest
votes
Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails
$ yarn upgrade webpack-merge@4.2.29 --non-interactive
yarn upgrade v1.13.0
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
$ echo $?
1
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54257436%2fhow-to-disable-yarn-interactive-prompt-for-yarn-upgrade%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails
$ yarn upgrade webpack-merge@4.2.29 --non-interactive
yarn upgrade v1.13.0
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
$ echo $?
1
add a comment |
Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails
$ yarn upgrade webpack-merge@4.2.29 --non-interactive
yarn upgrade v1.13.0
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
$ echo $?
1
add a comment |
Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails
$ yarn upgrade webpack-merge@4.2.29 --non-interactive
yarn upgrade v1.13.0
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
$ echo $?
1
Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails
$ yarn upgrade webpack-merge@4.2.29 --non-interactive
yarn upgrade v1.13.0
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
$ echo $?
1
answered yesterday
HanxueHanxue
4,78665585
4,78665585
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54257436%2fhow-to-disable-yarn-interactive-prompt-for-yarn-upgrade%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could experiment with I/O redirection with
yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the--non-interactiveflag happens to work withupgradethough it is not documented as such.– user268396
Jan 18 at 23:03