Npm:无法调用未定义的方法 'charAt'

Npm: Cannot call method 'charAt' of undefined

在项目中我们使用 travis

在我上次的 PR 中我遇到了一个错误:

$ npm install
npm ERR! git clone --template=/home/travis/.npm/_git-remotes/_templates --mirror git://github.com/*****/***-global.git /home/travis/.npm/_git-remotes/git-github-com-****-***-global-git-1c65c4d0
npm ERR! Linux 3.13.0-40-generic
npm ERR! argv "node" "/home/travis/.nvm/v0.10.38/bin/npm" "install"
npm ERR! node v0.10.38
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!     /home/travis/build/*****/*****-auth/npm-debug.log
The command "npm install" failed and exited with 1 during .

在开发机器上一切正常 我尝试使用 git+https / git:// 设置源 尝试为 travis 设置相同的节点/npm 版本 我什至尝试设置

os:
  - osx

相同

谁能帮帮我?

此错误已在 npm 2.7.5 中修复

所以我解决问题的方法是添加到 .travis.yml

before_install:
  - "npm install -g npm@^2.7.5"

它已在 npm 版本 2.7.5 中修复,因为它写在更新日志中 https://github.com/npm/npm/blob/master/CHANGELOG.md,#7746 错误修复。尝试更新 npm。