Vscode-vsce: `vsce` fails due to issue with `cheerio` dependency

Created on 6 May 2021  路  4Comments  路  Source: microsoft/vscode-vsce

It looks like the latest versions of the cheerio package are broken, which breaks new installs of vsce, which breaks our extension publishing pipeline. There's been a couple releases of that package within the past hour: https://www.npmjs.com/package/cheerio.

Repro steps:

$ npm install -g vsce
$ vsce publish ...

Error:

2021-05-06T15:39:22.1862516Z /usr/local/bin/vsce -> /usr/local/lib/node_modules/vsce/out/vsce
2021-05-06T15:39:22.2089164Z + [email protected]
2021-05-06T15:39:22.2090450Z added 72 packages from 41 contributors in 4.262s
2021-05-06T15:39:22.4765458Z internal/modules/cjs/loader.js:311
2021-05-06T15:39:22.4766970Z       throw err;
2021-05-06T15:39:22.4768423Z       ^
2021-05-06T15:39:22.4772111Z 
2021-05-06T15:39:22.4773596Z Error: Cannot find module '/usr/local/lib/node_modules/vsce/node_modules/cheerio/lib/index.js'. Please verify that the package.json has a valid "main" entry
2021-05-06T15:39:22.4774489Z     at tryPackage (internal/modules/cjs/loader.js:303:19)
2021-05-06T15:39:22.4775214Z     at Function.Module._findPath (internal/modules/cjs/loader.js:516:18)
2021-05-06T15:39:22.4775697Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
2021-05-06T15:39:22.4776361Z     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
2021-05-06T15:39:22.4777019Z     at Module.require (internal/modules/cjs/loader.js:952:19)
2021-05-06T15:39:22.4777444Z     at require (internal/modules/cjs/helpers.js:88:18)
2021-05-06T15:39:22.4777970Z     at Object.<anonymous> (/usr/local/lib/node_modules/vsce/out/package.js:22:17)
2021-05-06T15:39:22.4778410Z     at Module._compile (internal/modules/cjs/loader.js:1063:30)
2021-05-06T15:39:22.4778865Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
2021-05-06T15:39:22.4779532Z     at Module.load (internal/modules/cjs/loader.js:928:32) {
2021-05-06T15:39:22.4780113Z   code: 'MODULE_NOT_FOUND',
2021-05-06T15:39:22.4780673Z   path: '/usr/local/lib/node_modules/vsce/node_modules/cheerio/package.json',
2021-05-06T15:39:22.4781180Z   requestPath: 'cheerio'
2021-05-06T15:39:22.4781467Z }

Most helpful comment

Actually we fixed it in vsce as well by opting out of yarn.lock and using package-lock.json which npm respects.

All 4 comments

I had the exact same issue a couple of minutes ago. I fixed it by manually installing [email protected] in node/node_modules/vsce using: yarn add [email protected]. It is a nasty work around but it works for now.

Confirmed it's fixed now. Closing. 馃帀

Actually we fixed it in vsce as well by opting out of yarn.lock and using package-lock.json which npm respects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muuvmuuv picture muuvmuuv  路  6Comments

iliazeus picture iliazeus  路  6Comments

shanalikhan picture shanalikhan  路  6Comments

SamVerschueren picture SamVerschueren  路  5Comments

vfonic picture vfonic  路  6Comments