Vscode-vsce: `--yarn` can not work correctly after 1.81.0

Created on 2 Oct 2020  ·  13Comments  ·  Source: microsoft/vscode-vsce

If project has yarn.lock file, vsce will use yarn automatically. However, when using --yarn flag, it will fall back to npm

bug

Most helpful comment

I don't use yarn and I received the following error:

% vsce package            
Executing prepublish script 'yarn run vscode:prepublish'...
/bin/sh: yarn: command not found
 ERROR  yarn failed with exit code 127

These are the only packages I have globally:

% npm -g list --depth 0
/usr/local/lib
├── [email protected]
├── [email protected]
└── [email protected]

All 13 comments

I don't use yarn and I received the following error:

% vsce package            
Executing prepublish script 'yarn run vscode:prepublish'...
/bin/sh: yarn: command not found
 ERROR  yarn failed with exit code 127

These are the only packages I have globally:

% npm -g list --depth 0
/usr/local/lib
├── [email protected]
├── [email protected]
└── [email protected]

In addition to @roydukkey comments. A fresh project with no .yarnrc, yarn.lock or yarn executable installed is defaulting to yarn.

  • Azure build pipeline was working fine with vscode build plugin step (using Executing prepublish script 'npm run vscode:prepublish'...)
  • I have not installed yarn neither my repo has anything related to yarn.
  • Since today afternoon, prepublish is using Executing prepublish script 'yarn run vscode:prepublish'... and failing with
'yarn' is not recognized as an internal or external command,
operable program or batch file.
 ERROR  yarn failed with exit code 1

Does --no-yarn helps?

@felipecrs It did not, as I am using azure build pipeline. rather I am not sure what changes/task I need to change in azure pipeline. My extension scripts are

    "scripts": {
        "vscode:prepublish": "npm run compile",
        "compile": "tsc -p ./",
        "watch": "tsc -watch -p ./",
        "test": "npm run compile && node ./node_modules/vscode/bin/test"
    },

I can confirm the bug, I tried to debug but I was not able to.

For users facing this issue, I recommend to downgrade vsce:

{
  "devDependencies": {
    "vsce": "1.80.0"
  }
}

Okay, I found the issue.

The commander always sets the yarn option to true by default, rather than undefined.

/cc @rbuckton @joaomoreno

Submitted a PR. This behavior was fixed in commander 3.0.0.

adding --no-yarn fixed the issue, but I think every user need to update their pipeline for this is not a good recommendation.

adding --no-yarn fixed the issue, but I think every user need to update their pipeline for this is not a good recommendation.

For sure, it's not a solution, just a workaround until the issue gets fixed.

However, I believe the best workaround so far is to downgrade the vsce to 1.80.0.

Oof, sorry about that. Releasing a new version asap.

Sorry for the breakage everyone. v1.81.1 is cooking right now with the fix and should be out in a few minutes.

Thank you very much. @felipecrs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mlewand picture mlewand  ·  3Comments

brandoncc picture brandoncc  ·  6Comments

SamVerschueren picture SamVerschueren  ·  5Comments

muuvmuuv picture muuvmuuv  ·  6Comments

usernamehw picture usernamehw  ·  4Comments