Npm: Cannot call method 'charAt' of undefined - node.js

On project we use travis
on my last PR i've got an error:
$ 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 .
At dev machine all works fine
I tried set source with git+https / git://
try to set the same node / npm version for travis
i even try to set
os:
- osx
The same
Can anyone help me?

It is fixed in npm version 2.7.5, as it is written in changelog https://github.com/npm/npm/blob/master/CHANGELOG.md, #7746 bug fix. Try to update npm.

This bug was fixed at npm 2.7.5
So my way to resolve problem was add to .travis.yml
before_install:
- "npm install -g npm#^2.7.5"

Related

Errors installing nodegit in linux

I entered npm install nodegit and got the following error
npm ERR! Linux 3.10.0-514.2.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install" "nodegit"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! path /opt/portal_server/node_modules/nodegit
npm ERR! code EISGIT
npm ERR! git /opt/portal_server/node_modules/nodegit: Appears to be a git repo or submodule.
npm ERR! git /opt/portal_server/node_modules/nodegit
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
npm ERR! Please include the following file with any support request:
npm ERR! /opt/portal_server/npm-debug.log
Could you please suggest a way to resolve this error?
Try running this
sudo rm -rf node_modules/*/.git/
Then try installing nodegit

npm bcrypt installation error when using travis

I am getting a very strange error when I try to run Travis on my application after installing the bcrypt library. Everything installs and runs fine when on my local machine but when I try to use travis I get an error installing bcrypt from package.json. Anyone know how to fix this?
npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v6.11.0/bin/node" "/home/travis/.nvm/versions/node/v6.11.0/bin/npm" "install"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#1.0.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/travis/build/SamKirkiles/Teller/Server/npm-debug.log
The command "cd $TEST_DIR && npm install && npm test" exited with 1.
Done. Your build exited with 1.
Do you have your Travis Node.js configuration set up for compiling native modules?
Try adding this to your .travis.yml under the node_js setting (merge the env: bit together with any existing settings; you only need global: if you're building using a matrix e.g. testing on more than one Node version):
env:
global:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
I extracted this from the Travis docs page linked above.
If that doesn't work, maybe try linking to your .travis.yml here so we can see more about your build process.

Deploying to App Engine generates error with gulp?

What I wrote in terminal to deploy as usual:
gcloud app deploy
The error I get:
Application startup error:
> meanjs#0.5.0 start /app
> gulp
sh: 1: gulp: not found
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! meanjs#0.5.0 start: `gulp`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the meanjs#0.5.0 start script 'gulp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the meanjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs meanjs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls meanjs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log
Using Mean.js : https://github.com/meanjs/mean
Can't find the npm debug log.
P.S.: I did install gulp globally with
$ sudo npm install gulp-cli -g
First, you don't need to use sudo.
You can fix your error by typing this in terminal:
npm config set prefix ~/npm
# add this to your .bashrc (or .zshrc or whatever you are using)
export PATH="$PATH:$HOME/npm/bin"
Then re-install without sudo.
Hope this helps!
It seems that you did not install gulp in your server. Try to re-install gulp in your server with NodeJS and npm on your server and then install gulp with required packages it may resolve an error.
Please review an error you may find a solution
npm ERR! Make sure you have the latest version of node.js and npm
installed.
Install gulp in your project
npm install gulp
Install gulp globally.
npm install gulp -g
It was an issue with the NODE_ENV.
It would not find the gulp dependency in production, so I had to change my package.json and put everything in "dependencies" instead of using some in "dev_dependencies".

Can't install #types packages: Host key verification failed

When I try to run the following command:
npm install #types/react
I get the following output:
npm ERR! git clone git#github.com:types/react Cloning into bare repository
'C:\Users\lifeg\AppDa
ta\Roaming\npm-cache\_git-remotes\git-github-com-types-react-e0f5ee6a'...
npm ERR! git clone git#github.com:types/react Host key verification failed.
npm ERR! git clone git#github.com:types/react fatal: Could not read from remote repository.
npm ERR! git clone git#github.com:types/react
npm ERR! git clone git#github.com:types/react Please make sure you have the correct access right
s
npm ERR! git clone git#github.com:types/react and the repository exists.
npm ERR! addLocal Could not install types/react
npm ERR! Error: ENOENT: no such file or directory, stat 'C:\Users\lifeg\Documents\GitRepositorie
s\Personal\ReactMarkdown\types\react'
npm ERR! at Error (native)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 10.0.14393
npm ERR! command "C:\\Program Files\\nodejs\\node.exe"
"C:\\ProgramData\\chocolatey\\lib\\npm\\t
ools\\node_modules\\npm\\bin\\npm-cli.js" "install" "#types/react"
npm ERR! cwd C:\Users\lifeg\Documents\GitRepositories\Personal\ReactMarkdown
npm ERR! node -v v6.8.1
npm ERR! npm -v 1.4.9
npm ERR! path C:\Users\lifeg\Documents\GitRepositories\Personal\ReactMarkdown\types\react
npm ERR! syscall stat
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\lifeg\Documents\GitRepositories\Personal\ReactMarkdown\npm-debug.log
npm ERR! not ok code 0
Note the versions of Node/NPM:
npm ERR! node -v v6.8.1
npm ERR! npm -v 1.4.9
Something about the output suggests that the package was not installed correctly.
I get similar results when I try to install other #types packages, but packages like react install properly.
I updated NPM and the same error occurred before and after the update (the output is after).
Performing npm cache clean did nothing.
The error seems to be related to git and SSH, even though install is supposed to try accessing git through HTTPS first, it doesn't seem to want to do that in this case.
The problem
Basically, at one time I had experimented with a Windows package manager called Chocolatey and used it to install node.
However, I later re-installed node and NPM using the official installer. The two installations existed side-by-side and caused a variety of strange side-effects.
One of them was that when I ran npm install -g npm and it would update the version of NPM that came with node using the version that came with chocolatey. This caused me to have an outdated version of NPM, which which is problematic when working with Git
Your npm is very old and it's probably not the one that comes with your node package.

Using npm to install grunt on nodeenv results in findup-sync error

After establishing a node virtualenv using nodeenv, I use source /bin/activate
to switch into the correct directory, update npm, and execute
npm install -g grunt or npm install -g grunt-cli and I recieve the same error:
npm ERR! Linux 3.13.0-53-generic
npm ERR! argv "node" "/home/{redacted-home-dir}/NodeProjects/vue/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v0.12.4
npm ERR! npm v2.11.1
npm ERR! file /home/{redacted-home-dir}/.npm/findup-sync/0.1.3/package/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: /home/{redacted-home-dir}/.npm/findup-sync/0.1.3/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /home/{redacted-home-dir}/NodeProjects/vue/npm-debug.log
A similar error was noted on the findup-sync Github, but this the most recent edition of npm.
Grunt's package.json says "approximately 0.1.2" according to the npm docs.
I also have tried installing findup-sync independently, to no avail.
Other details about my computer: Linux (Debian/Ubuntu 14.04). 64bit.
You have maybe a corrupted cache : npm cache clean

Resources