Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'trim' of undefined #7

Closed
cybermaxs opened this issue Jul 11, 2015 · 5 comments
Closed

TypeError: Cannot read property 'trim' of undefined #7

cybermaxs opened this issue Jul 11, 2015 · 5 comments

Comments

@cybermaxs
Copy link

I open another one because issue persists using node > 0.11.5
It's impossible to list remotes, thus to use bower.
I have the same kind of error using git or http protocol.

HTTP

C:\issue>node node_modules\nogit\bin\git.js ls-remote --tags http://github.com/m
oment/moment.git
C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git-net\smart-htt
p.js:191
if (line.trim() !== '# service=git-upload-pack') {
^
TypeError: Cannot read property 'trim' of undefined
at C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git-net\sm
art-http.js:191:19
at read (C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git-
net\node_modules\push-to-pull\transform.js:14:32)
at onRead (C:\issue\node_modules\nogit\node_modules\git-node\node_modules\gi
t-net\node_modules\push-to-pull\transform.js:31:14)
at check (C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git
-node-platform\stream.js:45:16)
at IncomingMessage. (C:\issue\node_modules\nogit\node_modules\git
-node\node_modules\git-node-platform\stream.js:28:5)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)

GIT

C:\issue>node node_modules\nogit\bin\git.js ls-remote --tags http://github.com/m
oment/moment.git
C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git-net\smart-htt
p.js:191
if (line.trim() !== '# service=git-upload-pack') {
^
TypeError: Cannot read property 'trim' of undefined
at C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git-net\sm
art-http.js:191:19
at read (C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git-
net\node_modules\push-to-pull\transform.js:14:32)
at onRead (C:\issue\node_modules\nogit\node_modules\git-node\node_modules\gi
t-net\node_modules\push-to-pull\transform.js:31:14)
at check (C:\issue\node_modules\nogit\node_modules\git-node\node_modules\git
-node-platform\stream.js:45:16)
at IncomingMessage. (C:\issue\node_modules\nogit\node_modules\git
-node\node_modules\git-node-platform\stream.js:28:5)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)

@deenairn
Copy link

deenairn commented Aug 5, 2015

This is happening for one of our projects as well. I have removed the references within it. This command does work with the installed version of Git.

C:\Project>.bin\git.cmd ls-remote --tags git://url

C:\Project\packages\NoGit.0.0.9\node_modules\nogit
\node_modules\git-node\node_modules\git-net\discover.js:18
    line = line.trim();
                ^
TypeError: Cannot call method 'trim' of undefined
    at onLine (C:\Project\packages\NoGit.0.0.9\node_modules\nogit\node_modules\git-node\node_modules\git-net\discover.js:18:17)
    at read (C:\Project\packages\NoGit.0.0.9\node_modules\nogit\node_modules\git-node\node_modules\push-to-pull\transform.js:14:32)
    at onRead (C:\Project\packages\NoGit.0.0.9\node_modules\nogit\node_modules\git-node\node_modules\push-to-pull\transform.js:31:14)
    at check (C:\Project\packages\NoGit.0.0.9\node_modules\nogit\node_modules\git-node\node_modules\git-node-platform\stream.js:45:16)
    at Socket.<anonymous> (C:\Project\packages\NoGit.0.0.9\node_modules\nogit\node_modules\git-node\node_modules\git-node-platform\stream.js:28:5)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

@whyleee
Copy link
Owner

whyleee commented Aug 6, 2015

Hi guys, the problem is in old js-git dependency. New version looks like a complete rewrite and it's not well documented, so I need some time for update. A couple of days ago I reimplemented and fixed ls-remote command, you can take the code in vnext branch. But I still need to update clone and test everything before I can update nogit version.

@cybermaxs
Copy link
Author

ok thanks for your feedback. I will check when I have some free time

@whyleee
Copy link
Owner

whyleee commented Aug 9, 2015

I updated clone command, but it only works with TCP transport now (git:// urls). The code is still in vnext branch. I'm stuck with HTTP transport problem: my callback passed to "fetch" is never called and I can't figure out why 😕. I created an issue to js-git, maybe its owner can help. Otherwise I need to dig more into this problem..

@whyleee
Copy link
Owner

whyleee commented Nov 1, 2015

nogit is updated to 0.1.0 with Node.js 0.12/4/5 support. The issue is fixed in this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants