Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm ERR! Cannot call method 'charAt' of undefined #7746

Closed
mantoni opened this issue Mar 25, 2015 · 8 comments
Closed

npm ERR! Cannot call method 'charAt' of undefined #7746

mantoni opened this issue Mar 25, 2015 · 8 comments

Comments

@mantoni
Copy link
Contributor

mantoni commented Mar 25, 2015

With npm v2.7.4 I get this error:

npm ERR! git clone --template=~/.npm/_git-remotes/_templates \
  --mirror git://github.com/pipobscure/fsevents.git \
  ~/.npm/_git-remotes/git-github-com-pipobscure-fsevents-git-3baa7ac4
npm ERR! Linux 2.6.18-308.el5
npm ERR! argv "node" "/usr/bin/npm" "install"
npm ERR! node v0.10.38
npm ERR! npm  v2.7.4

npm ERR! Cannot call method 'charAt' of undefined

In the npm-debug.log there is this stack trace:

46611 verbose stack TypeError: Cannot call method 'charAt' of undefined
46611 verbose stack     at getResolved (/usr/lib/node_modules/npm/lib/cache/add-remote-git.js:357:14)
46611 verbose stack     at /usr/lib/node_modules/npm/lib/cache/add-remote-git.js:220:23
46611 verbose stack     at /usr/lib/node_modules/npm/lib/utils/git.js:26:8
46611 verbose stack     at ChildProcess.exithandler (child_process.js:656:7)
46611 verbose stack     at ChildProcess.emit (events.js:98:17)
46611 verbose stack     at maybeClose (child_process.js:766:16)
46611 verbose stack     at Socket.<anonymous> (child_process.js:979:11)
46611 verbose stack     at Socket.emit (events.js:95:17)
46611 verbose stack     at Pipe.close (net.js:466:12)

This error does not occur with npm v2.7.3.

node v0.10.38

@kenany
Copy link
Contributor

kenany commented Mar 25, 2015

@mantoni I don't suppose there is a command I can run to reproduce this?

@mantoni
Copy link
Contributor Author

mantoni commented Mar 25, 2015

As the error message suggests, it seems to happen when npm clones this git url: git://github.com/pipobscure/fsevents.git

I didn't find the time to put a reproducible example together. It must have been introduced with the latest patch release since it works fine with the version before.

@kenany
Copy link
Contributor

kenany commented Mar 25, 2015

@mantoni Okay. I'm on Linux and fsevents only installs on OS X so unfortunately I can't do much :/ maybe @othiym23 (who I believe is using OS X) can take a look some time.

At the very least, the repository is successfully cloned for me on 2.7.4: https://gist.github.com/KenanY/e15cd48fe46b4af354ee

@mantoni
Copy link
Contributor Author

mantoni commented Mar 25, 2015

Aaah, I'm was using Linux as well, but the clone might have failed due to our proxy at work. I'll try on OS X tonight as well and otherwise see whether I can put something reproducible together tomorrow.

@othiym23
Copy link
Contributor

This was a weird little bug, and would be difficult for anyone not very well-versed in the internals of npm (and the Node URL parser) to reproduce. Some versions of Node don't deal well with certain classes of Git URL (sticking : where it doesn't belong at the start of the path component of the URL). Writing a test for that would be... challenging, so I just fixed the problem at the source. Thanks for the report, @mantoni!

@mantoni
Copy link
Contributor Author

mantoni commented Mar 25, 2015

Oh wow. Thanks for the quick fix @othiym23.

@naterkane
Copy link

i have the same issue as well, that has worked up until v2.7.4

problem is... one of my deps is a private repo that has only seemed to work with git+ssh://

"ecfs-api-spec": "git+ssh://git@github.com:fccdev/ecfs-api-spec.git#v0.2.2"

however when changing it to git://github.com/fccdev/ecfs-api-spec.gif#v0.2.2 i got the same behavior.

$ npm install
npm WARN package.json karma-coverage@0.2.7 No README data
npm WARN package.json karma-chrome-launcher@0.1.7 No README data
npm ERR! git clone --template=/Users/naterkane/.npm/_git-remotes/_templates --mirror git://github.com/fccdev/ecfs-api-spec.git /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.33
npm ERR! npm  v2.7.4

npm ERR! Cannot call method 'charAt' of undefined
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/naterkane/Projects/fcc/ecfs/npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install' ]
2 info using npm@2.7.4
3 info using node@v0.10.33
4 verbose node symlink /usr/local/bin/node
5 verbose install where, deps [ '/Users/naterkane/Projects/fcc/ecfs',
5 verbose install   [ 'usps-webtools',
5 verbose install     'bower',
5 verbose install     'compass',
5 verbose install     'connect-modrewrite',
5 verbose install     'ecfs-api-spec',
5 verbose install     'grunt',
5 verbose install     'grunt-autoprefixer',
5 verbose install     'grunt-concurrent',
5 verbose install     'grunt-contrib-clean',
5 verbose install     'grunt-contrib-coffee',
5 verbose install     'grunt-contrib-compass',
5 verbose install     'grunt-contrib-concat',
5 verbose install     'grunt-contrib-connect',
5 verbose install     'grunt-contrib-copy',
5 verbose install     'grunt-contrib-cssmin',
5 verbose install     'grunt-contrib-htmlmin',
5 verbose install     'grunt-contrib-imagemin',
5 verbose install     'grunt-contrib-jshint',
5 verbose install     'grunt-contrib-uglify',
5 verbose install     'grunt-contrib-watch',
5 verbose install     'grunt-google-cdn',
5 verbose install     'grunt-karma',
5 verbose install     'grunt-karma-coveralls',
5 verbose install     'grunt-ng-annotate',
5 verbose install     'grunt-protractor-runner',
5 verbose install     'grunt-rev',
5 verbose install     'grunt-svgmin',
5 verbose install     'grunt-usemin',
5 verbose install     'grunt-wiredep',
5 verbose install     'gulp',
5 verbose install     'gulp-protractor-qa',
5 verbose install     'imagemin',
5 verbose install     'karma',
5 verbose install     'karma-chrome-launcher',
5 verbose install     'karma-coverage',
5 verbose install     'karma-jasmine',
5 verbose install     'karma-junit-reporter',
5 verbose install     'karma-ng-html2js-preprocessor',
5 verbose install     'karma-ng-scenario',
5 verbose install     'karma-phantomjs-launcher',
5 verbose install     'load-grunt-tasks',
5 verbose install     'lodash',
5 verbose install     'phantomjs',
5 verbose install     'pm2',
5 verbose install     'protractor',
5 verbose install     'time-grunt' ] ]
6 verbose install where, peers [ '/Users/naterkane/Projects/fcc/ecfs', [] ]
7 info preinstall fcc.ecfs@0.0.1
8 warn package.json karma-coverage@0.2.7 No README data
9 warn package.json karma-chrome-launcher@0.1.7 No README data
10 verbose already installed skipping grunt-contrib-clean@~0.6.0 /Users/naterkane/Projects/fcc/ecfs
11 verbose already installed skipping grunt-contrib-coffee@~0.12.0 /Users/naterkane/Projects/fcc/ecfs
12 verbose already installed skipping grunt-contrib-compass@^1.0.1 /Users/naterkane/Projects/fcc/ecfs
13 verbose already installed skipping grunt-contrib-concat@~0.5.0 /Users/naterkane/Projects/fcc/ecfs
14 verbose already installed skipping grunt-contrib-connect@~0.9.0 /Users/naterkane/Projects/fcc/ecfs
15 verbose already installed skipping grunt-contrib-copy@~0.7.0 /Users/naterkane/Projects/fcc/ecfs
16 verbose already installed skipping grunt-contrib-cssmin@~0.10.0 /Users/naterkane/Projects/fcc/ecfs
17 verbose already installed skipping grunt-contrib-htmlmin@~0.3.0 /Users/naterkane/Projects/fcc/ecfs
18 verbose already installed skipping grunt-contrib-imagemin@~0.9.2 /Users/naterkane/Projects/fcc/ecfs
19 verbose already installed skipping grunt-contrib-jshint@~0.10.0 /Users/naterkane/Projects/fcc/ecfs
20 verbose already installed skipping grunt-contrib-uglify@~0.6.0 /Users/naterkane/Projects/fcc/ecfs
21 verbose already installed skipping grunt-contrib-watch@~0.6.1 /Users/naterkane/Projects/fcc/ecfs
22 verbose already installed skipping grunt-google-cdn@~0.4.3 /Users/naterkane/Projects/fcc/ecfs
23 verbose already installed skipping grunt-karma@^0.9.0 /Users/naterkane/Projects/fcc/ecfs
24 verbose already installed skipping grunt-karma-coveralls@^2.5.2 /Users/naterkane/Projects/fcc/ecfs
25 verbose already installed skipping grunt-ng-annotate@^0.6.0 /Users/naterkane/Projects/fcc/ecfs
26 verbose already installed skipping grunt-protractor-runner@~1.1.4 /Users/naterkane/Projects/fcc/ecfs
27 verbose already installed skipping grunt-rev@~0.1.0 /Users/naterkane/Projects/fcc/ecfs
28 verbose already installed skipping grunt-svgmin@~2.0.0 /Users/naterkane/Projects/fcc/ecfs
29 verbose already installed skipping grunt-usemin@~2.6.1 /Users/naterkane/Projects/fcc/ecfs
30 verbose already installed skipping grunt-wiredep@^2.0.0 /Users/naterkane/Projects/fcc/ecfs
31 verbose already installed skipping gulp@^3.8.10 /Users/naterkane/Projects/fcc/ecfs
32 verbose already installed skipping gulp-protractor-qa@^0.1.17 /Users/naterkane/Projects/fcc/ecfs
33 silly cache add args [ 'imagemin@git://github.com/naterkane/imagemin.git#master',
33 silly cache add   null ]
34 verbose cache add spec imagemin@git://github.com/naterkane/imagemin.git#master
35 verbose already installed skipping karma@^0.12.24 /Users/naterkane/Projects/fcc/ecfs
36 verbose already installed skipping karma-chrome-launcher@^0.1.5 /Users/naterkane/Projects/fcc/ecfs
37 verbose already installed skipping karma-coverage@^0.2.6 /Users/naterkane/Projects/fcc/ecfs
38 verbose already installed skipping karma-jasmine@^0.2.3 /Users/naterkane/Projects/fcc/ecfs
39 verbose already installed skipping karma-junit-reporter@~0.2.2 /Users/naterkane/Projects/fcc/ecfs
40 silly cache add parsed spec { raw: 'imagemin@git://github.com/naterkane/imagemin.git#master',
40 silly cache add   scope: null,
40 silly cache add   name: 'imagemin',
40 silly cache add   rawSpec: 'git://github.com/naterkane/imagemin.git#master',
40 silly cache add   spec: 'git+ssh://git@github.com/naterkane/imagemin.git#master',
40 silly cache add   type: 'hosted',
40 silly cache add   hosted:
40 silly cache add    { type: 'github',
40 silly cache add      ssh: 'git@github.com:naterkane/imagemin.git#master',
40 silly cache add      sshUrl: 'git+ssh://git@github.com/naterkane/imagemin.git#master',
40 silly cache add      httpsUrl: 'https://github.com/naterkane/imagemin.git#master',
40 silly cache add      directUrl: 'https://raw.githubusercontent.com/naterkane/imagemin/master/package.json' } }
41 info maybeGithub Attempting git://github.com/naterkane/imagemin.git#master from git://github.com/naterkane/imagemin.git#master
42 verbose addRemoteGit git-github-com-naterkane-imagemin-git-3aa29956 not in flight; caching
43 verbose already installed skipping karma-ng-html2js-preprocessor@~0.1.2 /Users/naterkane/Projects/fcc/ecfs
44 verbose already installed skipping karma-ng-scenario@^0.1.0 /Users/naterkane/Projects/fcc/ecfs
45 verbose already installed skipping karma-phantomjs-launcher@^0.1.4 /Users/naterkane/Projects/fcc/ecfs
46 verbose already installed skipping load-grunt-tasks@~1.0.0 /Users/naterkane/Projects/fcc/ecfs
47 verbose already installed skipping lodash@^2.4.1 /Users/naterkane/Projects/fcc/ecfs
48 verbose already installed skipping phantomjs@^1.9.12 /Users/naterkane/Projects/fcc/ecfs
49 verbose already installed skipping pm2@^0.12.3 /Users/naterkane/Projects/fcc/ecfs
50 verbose already installed skipping protractor@~1.5.0 /Users/naterkane/Projects/fcc/ecfs
51 verbose already installed skipping time-grunt@~1.0.0 /Users/naterkane/Projects/fcc/ecfs
52 info git [ 'config', '--get', 'remote.origin.url' ]
53 verbose already installed skipping usps-webtools@0.0.10 /Users/naterkane/Projects/fcc/ecfs
54 verbose addRemoteGit remote.origin.url: git://github.com/naterkane/imagemin.git
55 verbose addRemoteGit updating existing cached remote /Users/naterkane/.npm/_git-remotes/git-github-com-naterkane-imagemin-git-3aa29956
56 verbose already installed skipping bower@^1.3.12 /Users/naterkane/Projects/fcc/ecfs
57 verbose already installed skipping compass@~0.1.1 /Users/naterkane/Projects/fcc/ecfs
58 info git [ 'fetch', '-a', 'origin' ]
59 verbose already installed skipping connect-modrewrite@~0.7.9 /Users/naterkane/Projects/fcc/ecfs
60 silly cache add args [ 'ecfs-api-spec@git://github.com/fccdev/ecfs-api-spec.git#v0.2.2',
60 silly cache add   null ]
61 verbose cache add spec ecfs-api-spec@git://github.com/fccdev/ecfs-api-spec.git#v0.2.2
62 verbose already installed skipping grunt@^0.4.5 /Users/naterkane/Projects/fcc/ecfs
63 verbose already installed skipping grunt-autoprefixer@^2.0.0 /Users/naterkane/Projects/fcc/ecfs
64 silly cache add parsed spec { raw: 'ecfs-api-spec@git://github.com/fccdev/ecfs-api-spec.git#v0.2.2',
64 silly cache add   scope: null,
64 silly cache add   name: 'ecfs-api-spec',
64 silly cache add   rawSpec: 'git://github.com/fccdev/ecfs-api-spec.git#v0.2.2',
64 silly cache add   spec: 'git+ssh://git@github.com/fccdev/ecfs-api-spec.git#v0.2.2',
64 silly cache add   type: 'hosted',
64 silly cache add   hosted:
64 silly cache add    { type: 'github',
64 silly cache add      ssh: 'git@github.com:fccdev/ecfs-api-spec.git#v0.2.2',
64 silly cache add      sshUrl: 'git+ssh://git@github.com/fccdev/ecfs-api-spec.git#v0.2.2',
64 silly cache add      httpsUrl: 'https://github.com/fccdev/ecfs-api-spec.git#v0.2.2',
64 silly cache add      directUrl: 'https://raw.githubusercontent.com/fccdev/ecfs-api-spec/v0.2.2/package.json' } }
65 info maybeGithub Attempting git://github.com/fccdev/ecfs-api-spec.git#v0.2.2 from git://github.com/fccdev/ecfs-api-spec.git#v0.2.2
66 verbose addRemoteGit git-github-com-fccdev-ecfs-api-spec-git-29f76ded not in flight; caching
67 verbose already installed skipping grunt-concurrent@~1.0.0 /Users/naterkane/Projects/fcc/ecfs
68 info git [ 'clone',
68 info git   '--template=/Users/naterkane/.npm/_git-remotes/_templates',
68 info git   '--mirror',
68 info git   'git://github.com/fccdev/ecfs-api-spec.git',
68 info git   '/Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded' ]
69 error git clone --template=/Users/naterkane/.npm/_git-remotes/_templates --mirror git://github.com/fccdev/ecfs-api-spec.git /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded
70 verbose git clone --template=/Users/naterkane/.npm/_git-remotes/_templates --mirror git://github.com/fccdev/ecfs-api-spec.git /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded: Cloning into bare repository '/Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded'...
70 verbose git clone --template=/Users/naterkane/.npm/_git-remotes/_templates --mirror git://github.com/fccdev/ecfs-api-spec.git /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded: fatal: remote error:
70 verbose git clone --template=/Users/naterkane/.npm/_git-remotes/_templates --mirror git://github.com/fccdev/ecfs-api-spec.git /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-29f76ded:   Repository not found.
71 info maybeGithub Couldn't clone git://github.com/fccdev/ecfs-api-spec.git#v0.2.2
72 info maybeGithub Now attempting git://github.com/fccdev/ecfs-api-spec.git#v0.2.2 from git@github.com:fccdev/ecfs-api-spec.git#v0.2.2
73 verbose addRemoteGit git-github-com-fccdev-ecfs-api-spec-git-a72c4032 not in flight; caching
74 info git [ 'config', '--get', 'remote.origin.url' ]
75 verbose addRemoteGit remote.origin.url: git@github.com:fccdev/ecfs-api-spec.git
76 verbose addRemoteGit updating existing cached remote /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-a72c4032
77 info git [ 'fetch', '-a', 'origin' ]
78 verbose addRemoteGit git fetch -a origin (git://github.com/naterkane/imagemin.git)
79 verbose addRemoteGit set permissions on /Users/naterkane/.npm/_git-remotes/git-github-com-naterkane-imagemin-git-3aa29956
80 verbose addRemoteGit original treeish: master
81 info git [ 'rev-list', '-n1', 'master' ]
82 silly addRemoteGit resolved treeish: a5686790bd3b2551b9aca49eef9652636975b477
83 verbose addRemoteGit resolved Git URL: git://github.com/naterkane/imagemin.git#a5686790bd3b2551b9aca49eef9652636975b477
84 silly addRemoteGit Git working directory: /var/folders/nh/sv3z8c0s6gj23ssfzxt10fnh0000gn/T/npm-82731-10b0f775/git-cache-2704a2ede391/a5686790bd3b2551b9aca49eef9652636975b477
85 info git [ 'clone',
85 info git   '/Users/naterkane/.npm/_git-remotes/git-github-com-naterkane-imagemin-git-3aa29956',
85 info git   '/var/folders/nh/sv3z8c0s6gj23ssfzxt10fnh0000gn/T/npm-82731-10b0f775/git-cache-2704a2ede391/a5686790bd3b2551b9aca49eef9652636975b477' ]
86 verbose addRemoteGit clone Cloning into '/var/folders/nh/sv3z8c0s6gj23ssfzxt10fnh0000gn/T/npm-82731-10b0f775/git-cache-2704a2ede391/a5686790bd3b2551b9aca49eef9652636975b477'...
86 verbose addRemoteGit done.
87 info git [ 'checkout', 'a5686790bd3b2551b9aca49eef9652636975b477' ]
88 verbose addRemoteGit checkout Note: checking out 'a5686790bd3b2551b9aca49eef9652636975b477'.
88 verbose addRemoteGit
88 verbose addRemoteGit You are in 'detached HEAD' state. You can look around, make experimental
88 verbose addRemoteGit changes and commit them, and you can discard any commits you make in this
88 verbose addRemoteGit state without impacting any branches by performing another checkout.
88 verbose addRemoteGit
88 verbose addRemoteGit If you want to create a new branch to retain commits you create, you may
88 verbose addRemoteGit do so (now or later) by using -b with the checkout command again. Example:
88 verbose addRemoteGit
88 verbose addRemoteGit   git checkout -b new_branch_name
88 verbose addRemoteGit
88 verbose addRemoteGit HEAD is now at a568679... change error handling to display error to console before throwing error
89 verbose addLocalDirectory /Users/naterkane/.npm/imagemin/3.0.0/package.tgz not in flight; packing
90 verbose tar pack [ '/Users/naterkane/.npm/imagemin/3.0.0/package.tgz',
90 verbose tar pack   '/var/folders/nh/sv3z8c0s6gj23ssfzxt10fnh0000gn/T/npm-82731-10b0f775/git-cache-2704a2ede391/a5686790bd3b2551b9aca49eef9652636975b477' ]
91 verbose tarball /Users/naterkane/.npm/imagemin/3.0.0/package.tgz
92 verbose folder /var/folders/nh/sv3z8c0s6gj23ssfzxt10fnh0000gn/T/npm-82731-10b0f775/git-cache-2704a2ede391/a5686790bd3b2551b9aca49eef9652636975b477
93 verbose addLocalTarball adding from inside cache /Users/naterkane/.npm/imagemin/3.0.0/package.tgz
94 verbose addRemoteGit data._resolved: git://github.com/naterkane/imagemin.git#a5686790bd3b2551b9aca49eef9652636975b477
95 silly addRemoteGit data._from: git://github.com/naterkane/imagemin.git#master
96 silly cache afterAdd imagemin@3.0.0
97 verbose afterAdd /Users/naterkane/.npm/imagemin/3.0.0/package/package.json not in flight; writing
98 verbose afterAdd /Users/naterkane/.npm/imagemin/3.0.0/package/package.json written
99 info already installed imagemin@3.0.0
100 verbose addRemoteGit git fetch -a origin (git@github.com:fccdev/ecfs-api-spec.git)
101 verbose addRemoteGit set permissions on /Users/naterkane/.npm/_git-remotes/git-github-com-fccdev-ecfs-api-spec-git-a72c4032
102 verbose addRemoteGit original treeish: v0.2.2
103 info git [ 'rev-list', '-n1', 'v0.2.2' ]
104 silly addRemoteGit resolved treeish: 0e1851c8aa47c14b886fad4d6114cab10491343f
105 verbose type non_object_property_call
106 verbose stack TypeError: Cannot call method 'charAt' of undefined
106 verbose stack     at getResolved (/usr/local/lib/node_modules/npm/lib/cache/add-remote-git.js:357:14)
106 verbose stack     at /usr/local/lib/node_modules/npm/lib/cache/add-remote-git.js:220:23
106 verbose stack     at /usr/local/lib/node_modules/npm/lib/utils/git.js:26:8
106 verbose stack     at ChildProcess.exithandler (child_process.js:646:7)
106 verbose stack     at ChildProcess.emit (events.js:98:17)
106 verbose stack     at maybeClose (child_process.js:756:16)
106 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:823:5)
107 verbose cwd /Users/naterkane/Projects/fcc/ecfs
108 error Darwin 14.1.0
109 error argv "node" "/usr/local/bin/npm" "install"
110 error node v0.10.33
111 error npm  v2.7.4
112 error Cannot call method 'charAt' of undefined
113 error If you need help, you may report this error at:
113 error     <https://github.com/npm/npm/issues>
114 verbose exit [ 1, true ]

@naterkane
Copy link

npm install npm@2.7.3 -g works. 2.7.5 doesn't error out, but still doesn't install the private repo

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

No branches or pull requests

4 participants