Vscode-vsce: vsce suddenly broke. Error: Cannot find module 'vso-node-api/HttpClient'

Created on 16 Feb 2018  路  8Comments  路  Source: microsoft/vscode-vsce

I tried reinstalling but to no avail. Every time I try to run vsce package in any of our projects it fails with this kind of error:

Error: Cannot find module 'vso-node-api/HttpClient'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/kdvolder/node_modules/vsce/out/publicgalleryapi.js:3:20)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)

It was working fine just hours ago and nothing much has changed in our projects. Perhaps something has changed in/with vsce dependencies?

Most helpful comment

Yep! I'm facing the same problem! The issue is for breaking change in vso-node-api with patch update!

WORKAROUND:
I've opened the vsce installed files from global npm directory (~/.npm-global/lib/node_modules/vsce/) and tried to manually install the specific verison of vso-node-api.

> npm install [email protected]

and it works!

All 8 comments

This might be useful to know.

$ npm --version
5.6.0

$ node --version
v8.9.4

$ vsce --version
module.js:540
    throw err;
    ^

Error: Cannot find module 'vso-node-api/HttpClient'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/kdvolder/node_modules/vsce/out/publicgalleryapi.js:3:20)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)

Hmm well... funny even vsce --version isn't working. But in package.json of installed vsce bundle it looks like version 1.36.2:

{
  "_from": "vsce",
  "_id": "[email protected]",
...

Interesting: on here: https://www.npmjs.com/package/vso-node-api

It says:

vsonline published 2 hours ago

Yeah that sounds about like... right about the time when vsce broke for us.

This workaround works for us:

https://github.com/spring-projects/sts4/commit/dcb08077f5a3368f2c7e005d3c81fb154ce6cd1e

I.e. we make sure the vsce we use to package our vscode extensions sticks to an older version vso-node-api version 6.1.2-preview

Having the same problem. 8-(

@joaomoreno I think we might be needed to lock the version on to 6.1.2-preview until https://github.com/Microsoft/vsts-node-api/issues/126 is solved.

Another error when installing with yarn. Works with npm.

package.json:

    "devDependencies": {
        "vsce": "^1.36.1",
        "vso-node-api": "6.1.2-preview"
    }

and error:

$ npx vsce create-publisher rofrol
Publisher human-friendly name: (rofrol) 
E-mail: rofrol@myemail
Personal Access Token: ****************************************************

Error: api.createPublisher is not a function

Yep! I'm facing the same problem! The issue is for breaking change in vso-node-api with patch update!

WORKAROUND:
I've opened the vsce installed files from global npm directory (~/.npm-global/lib/node_modules/vsce/) and tried to manually install the specific verison of vso-node-api.

> npm install [email protected]

and it works!

Thanks for the investigation guys! Fixed in 1.36.3.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

equinusocio picture equinusocio  路  4Comments

joaomoreno picture joaomoreno  路  6Comments

RomaDev94 picture RomaDev94  路  5Comments

joaomoreno picture joaomoreno  路  4Comments

joaomoreno picture joaomoreno  路  4Comments