santinic / how2

AI for the Command Line
https://how2terminal.com
MIT License
5.72k stars 156 forks source link

error after pressing space #68

Closed smmoosavi closed 7 years ago

smmoosavi commented 8 years ago

every time I press space following error shown:

Press SPACE for more choices, any other key to quit.
TypeError: Invalid Version: null
    at new SemVer (/home/my-user/.npm-packages/lib/node_modules/how2/node_modules/semver/semver.js:279:11)
    at compare (/home/my-user/.npm-packages/lib/node_modules/how2/node_modules/semver/semver.js:566:10)
    at Function.gt (/home/my-user/.npm-packages/lib/node_modules/how2/node_modules/semver/semver.js:595:10)
    at /home/my-user/.npm-packages/lib/node_modules/how2/lib/updates.js:15:19
    at Request._callback (/home/my-user/.npm-packages/lib/node_modules/how2/node_modules/npm-latest/lib/npm-latest.js:53:5)
    at Request.self.callback (/home/my-user/.npm-packages/lib/node_modules/how2/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/home/my-user/.npm-packages/lib/node_modules/how2/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
smmoosavi commented 8 years ago

I found that this error occurs when I use sinopia as proxy for npm

cat .npmrc
registry=http://localhost:4873/
danyshaanan commented 8 years ago

@smmoosavi - Can you compare your how2 version in both cases, and if identical, compare the versions of its dependencies when installed with and without?

smmoosavi commented 8 years ago
how2 --version
how2 version 1.1.0 - by Claudio Santini
danyshaanan commented 8 years ago

Please give exact reproduction steps so that we could test this, and include OS type and version, node version, and npm version.

smmoosavi commented 8 years ago

If you want to reproduce error:

$ npm i how2
$ npm i sinopia
$ cat ~/.npmrc  # is empty
$ ./node_modules/.bin/how2 -l python list length  
# no error until this line

$ npm set registry http://localhost:4873
$ cat ~/.npmrc
registry=http://localhost:4873

$./node_modules/.bin/sinopia
$ ./node_modules/.bin/how2 -l python list length 
# errors TypeError: Invalid Version: null ...

$ echo '' > ~/.npmrc
./node_modules/.bin/how2 -l python list length  
# every thing is ok

Ubuntu 14.04 LTS npm 3.3.12 node v5.1.0

danyshaanan commented 8 years ago

Probably an issue with npm-latest, originating in this line.

Could you please run:

npm i npm-latest
echo '' > ~/.npmrc
./node_modules/.bin/npm-latest how2
echo 'registry=http://localhost:4873' > ~/.npmrc
./node_modules/.bin/sinopia
./node_modules/.bin/npm-latest how2

?

smmoosavi commented 8 years ago

yes, you are right. with sinopia

  how2: 
    latest: null
    last updated: null

with default registry

  how2: 
    latest: 1.1.0
    last updated: Mon Mar 07 2016 23:53:18 GMT+0330 (IRST)
    author: Claudio Santini
    repo: https://github.com/santinic/how2
    description: Uses Google and Stackoverflow to find how to do things on a Unix commmand line