depjs / dep

A little Node.js dependency installer
https://github.com/depjs/dep#readme
MIT License
189 stars 15 forks source link

TypeError: Cannot read property 'tarball' of undefined #63

Closed austinfrey closed 6 years ago

austinfrey commented 6 years ago

Summary

Getting the following error when installing any module.

Resolving dependencies
TypeError: Cannot read property 'tarball' of undefined
    at Request.request.get.on.on (/home/austin/.nvm/versions/node/v8.11.1/lib/node_modules/dep/lib/install/resolver/fetchers/registry.js:28:32)
    at emitOne (events.js:121:20)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/home/austin/.nvm/versions/node/v8.11.1/lib/node_modules/dep/node_modules/request/request.js:1091:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Current setup:

$ node -v
v8.11.1

$ npm -v
6.0.1

$ dep -v
0.18.0

$ uname -a
Linux lappy-88 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:    18.04
Codename:   bionic

I should also mention I'm using nvm to manage npm and node.

Steps to reproduce behavior

$ npm install -g dep
$ npm init -y
$ dep install hyperscript

Expected behavior

dep install <module> should successfully install the package

Actual behavior

Throws the above listed error

austinfrey commented 6 years ago

Looking at this a bit more, when parsing the package version: https://github.com/depjs/dep/blob/f8c97a68fa2a98736558bcccd6151e7b2409cbe8/lib/install/resolver/fetchers/registry.js#L5 I'm not sure this regex is enough to handle all the different formats and and concating the 'v' seems to break the links as well. Has anyone else run into this issue or am I really missing the mark?

watilde commented 6 years ago

Hey, thank you for your report!

I think this was used to work, but the registry changed their API that does not allow semver ranges as a part of GET request params. I'd change alogorithm of fetching a bit.

e.g.

watilde commented 6 years ago

This issue was fixed at v0.18.1 🎉

Thanks for putting your time to build depjs together.

austinfrey commented 6 years ago

@watilde thanks for the speedy reply. I'll try it out this afternoon!