Error when installing log.io using npm - node.js

I am trying to install log.io following the instruction from https://github.com/NarrativeScience/Log.io. It suggests using npm install command.
npm install -g log.io
The error I am getting is like below. And I tried on both Mac OS and Ubuntu, both no luck. Can anyone help me?
> contextify#0.1.13 install /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
> node-gyp rebuild
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssstyle
gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/jsdom/node_modules/request/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
...

Finally I found the problems.
Ubuntu
On Ubuntu 14.04, the default repository of apt-get for node is not nodejs itself, but ax25-node. This will generate a default command node in /usr/sbin/ and does nothing if you call node (which is called by npm during the installation). I removed this package and created a symlink between node and nodejs, finally solved the problem.
sudo apt-get autoremove node
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g log.io
Mac OS
The error log is quite different from what I got from Ubuntu. After some googling about node-gyp installation failure, I found this issue, which led me to install the Xcode dev tools. Not sure why this happens but it seems there are some conflicts between homebrew and Xcode. Anyway, it finally works :-)

This looks like a race condition in an older version of npm. There have been a lot of improvements to npm -- especially around conflicts and race conditions during install -- since 1.4. Can you try updating your npm installation?
To update npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
If you still see the problem after updating npm, could you please upload your npm-debug.log as a gist http://gist.github.com? If possible, run npm with at least one -d flag to increase the logging level.
Thanks!

i create this install package...
http://tinyurl.com/kfnfng6
1 - download it
2 - untar it (tar -xvf install_log.io.tar)
3 - cd install_log.io
4 - sh install.sh
5 - enjoy!
This form is simple and quiet.. i hope help other users... What i do? simple.. download packages and dependencies , and put all in one package and create a script...
;)

Related

How can I change npm version while using create-react-app

I am trying to run create-react-app in my command line, and I keep getting this message:
"You are using npm 2.15.12 so the project will be boostrapped with an old unsupported version of tools."
I ran
sudo npm install npm#latest -g
to make sure I have the latest version of npm (I also tried "sudo npm install -g npm"). And when I run
npm -v
the output is "6.4.1"
I get a number of errors during the create-react-app process, but the app itself seems to work fine, "npm start" works and all the files seem to be in the right place, but I don't want to run into more errors down the road.
After a couple hours of searching, I can't find any other issues of create-react-app using the wrong version of npm. Is there a way to change the version of npm being used while using create-react-app?
The hidden code snippet below lists the errors that I get during create-react-app. I feel like they might be due to using the outdated version of npm.
node-pre-gyp ERR! Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.17/fse-v1.0.17-node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents#1.0.17 and node#11.0.0 (node-v67 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.17/fse-v1.0.17-node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents#1.0.17 and node#11.0.0 (node-v67 ABI) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/myuser/node_modules/npm/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute
Solved. I believe I had some extra node files floating around (potentially from installations I didn't do correctly). I decided to do a complete removal of nvm/node/npm and get a fresh install (I am on a mac).
To remove nvm and node, I removed all node and node_package files in /usr (there are quite a few tutorials on where to find node files and folders). I followed the guides but also had a few exceptions. I had a folder that was simply named "n" that had some node files in it (which I then deleted) and then had to show my hidden files to find an ".nvm" folder in /users/userName. I deleted the ".nvm" folder and was finally able to completely get rid of nvm, node and npm.
After I freshly installed nvm and node (I had to remake the .nvm folder for the nvm install script to work), the create-react-app command is working correctly.
You need to update your npm version using this:
npm install -g npm
Please note that this command will remove your current version of npm. Make sure to use
sudo npm install -g npm
if on a Mac.

node-gyp rebuild fails on Mac OS High Sierra while npm install

I am getting following error in the terminal, while it tries to install one of package "node-expat". I have tried switching to different node version using nvm but still it is failing with same error.
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/node-expat
npm ERR! node v6.5.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! node-expat#2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.0.0 install script 'node-gyp rebuild'.
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 node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\<redacted>\npm-debug.log
I went ahead installing x-code as suggested on git hub page, on my machine and then it is giving following error,. Not sure how to debug further.
xcode-select: error: tool 'xcodebuild' requires Xcode,
but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
I just got it fixed on my machine and my fellow colleagues machine.
Followed the following steps to fix it on MacOS highSierra 10.13:
Downloaded command line tools (MacOS 10.13) for xcode and installed it.
Download it from "https://developer.apple.com/download/more/"
Installed xcode 10.0 from the app store. Opened xcode and went through the regular configuration xcode does in the initial start up.
After this it started giving "xcode-select" path issue as stated in the description above. On running command "xcode-select --print-path" it was showing path as '/ Library/Developer/CommandLineTools', so i went ahead and tried "xcode-select --reset" after which the path changed to "/Applications/Xcode.app/Contents/Developer".
Immediately after it the build started working without any issues.
Solution above mentioned by Luke worked partially for me (MacOS) but created another issue :
gyp ERR! stack Error:makefailed with exit code: 2 which was solved by removing locked json file. Issue was created due to permission in MAC OS. So if you have xcode re-installed already, open terminal (command line) and type:
xcode-select --reset
then go to your project folder and remove:
package-lock.json
Now in terminal reinstall project :
npm install
I hope this helps someone!

Unable to verify the first certificate (grpc/node)

For some background, I am following along with this tutorial, trying to get the node example working.
I have downloaded the folder, cd'd into the directory, and tried to run npm install.
I get the following stack trace.
npm WARN package.json grpc-examples#0.1.0 No repository field.
npm WARN package.json grpc-examples#0.1.0 No license field.
\
> grpc#1.12.2 install /tmp/grpc/examples/node/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Tried to download(400): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.12.2/node-v46-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc#1.12.2 and node#4.5.0 (node-v46 ABI, glibc) (falling back to source compile with node-gyp)
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1022:38)
gyp ERR! stack at emitNone (events.js:67:13)
gyp ERR! stack at TLSSocket.emit (events.js:166:7)
gyp ERR! stack at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:586:8)
gyp ERR! stack at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:428:38)
gyp ERR! System Linux 4.8.13-100.fc23.x86_64
gyp ERR! command "/home/nbkiq0w/.nvm/versions/node/v4.5.0/bin/node" "/home/nbkiq0w/.nvm/versions/node/v4.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--libr$ry=static_library" "--module=/tmp/grpc/examples/node/node_modules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/grpc/examples/node/node_mo$ules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc" "--node_abi_napi=node-v46"
There's a bit more to the stack trace, but I think this gets the gist of it.
Unable to verify the first certificate
seems relevant here.
I googled a bit and found this, which seems to address my issue. I modified the example source code,
examples/node/dynamic_codegen/greeter_server.js
So it now has the following added to the top of the existing file.
var rootCas = require('ssl-root-cas/latest').create();
rootCas
.addFile('/etc/pki/ca-trust/source/anchors/amrs-g2.cer');
require('https').globalAgent.options.ca = rootCas;
In an attempt to follow this pattern. I am still seeing the same issue.
Anyone have any ideas? I should mention that I am running node version 4.5.0 and npm version 2.15.9.
I've tried messing around with the versions a bit, but can't get it working.
edit 1:
Tried updating node version to 10.0.0
Npm version 5.6.0
Tried the npm install again, this time got a weird error...
npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: async#^1.5.2
edit 2:
Tried running the command over and over, seems like the library it fails on is more or less random.
npm ERR! code E418
npm ERR! 418 I'm a teapot: grpc#^1.0.0
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: google-protobuf#^3.0.0
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: lodash#^4.6.1
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: grpc#^1.0.0
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: lodash#^4.6.1
Seems like it just fails regardless of library, I tried updating my proxy settings like seen here. Doesn't seem to help.
edit 3:
switched back to node 6.12.0, and seeing the original tls error. One of my friends was able to download the node directory as is, and run on his machine (using 6.12.0), so it must be something isolated to my machine.
I found on another page some advice to adjust my .npmrc file found in my home directory. I added the following line
cafile=<my cert file>
And the npm install worked. I'm unsure why my friend's install worked, since he didn't even have this file, but this is good enough for the time being.

sudo npm install gives me a access denied

I am using ionic and I have fetched my project through git from machine1 to machine2.
My ionic infos gives me this :
[ERROR] Error with ./node_modules/#ionic/app-scripts/package.json
file: FILE_NOT_FOUND
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
local packages:
#ionic/app-scripts : not installed
Ionic Framework : ionic-angular 3.7.1
System:
Node : v8.9.1
npm : 5.5.1
OS : macOS High Sierra
Misc:
backend : pro
When I run sudo npm install I get the following :
npm WARN checkPermissions Missing write access to
/Users/gerald/Documents/ionic/yesterdayweather/node_modules npm WARN
checkPermissions Missing write access to
/Users/gerald/Documents/ionic/yesterdayweather/node_modules/#ionic
And then
gyp ERR! configure error gyp ERR! stack Error: EACCES: permission
denied, mkdir
'/Users/gerald/Documents/ionic/yesterdayweather/node_modules/node-sass/build'
gyp ERR! System Darwin 17.2.0 gyp ERR! command
"/usr/local/Cellar/node/8.9.1/bin/node"
"/Users/gerald/Documents/ionic/yesterdayweather/node_modules/node-gyp/bin/nod
e-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags="
"--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd
/Users/gerald/Documents/ionic/yesterdayweather/node_modules/node-sass
gyp ERR! node -v v8.9.1 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok
Build failed with error code: 1 npm ERR! code ELIFECYCLE npm ERR!
errno 1 npm ERR! node-sass#4.5.3 postinstall: node scripts/build.js
npm ERR! Exit status 1
I have tried the following solution 1 and 3.
Basically I think I had node installed in a pkg way, so I removed it and intalled it with brew, so actually I should not have this issue.
But I tried anyway option 1 and it still does not work.
Any idea ?
Thanks !
It looks like a script is trying to write files, which npm by default denies when running as root. You can put --unsafe-perm behind the command to disable this safeguard.
You also should not run npm install with sudo because it is not necessary. Only when using the -g flag for installing modules globally should you use sudo.
2019 EDIT: It goes without saying that disabling safe guards like this can be very dangerous because you're giving a script a free pass to do whatever it wants. It's best to never use sudo and npm together, even when installing modules globally. If you're running into access issues with npm look into using a version manager or changing npm's default directory.
You shouldn't use sudo npm install. Clean up your environment (see more in my answer here) and then run just npm install.

trying to install bcrypt into node project + node set up issues

I have seen some very similar questions but none that I have found seem to work. I am trying to npm install bcrypt but i keep getting the error below.
bycrypt is the command that I use to install bcrypt modules. I do have Xcode and installing node-gyp does not seem to make a difference
regan#the-Voyagur buddha-bar (feature/styles) $ npm install --save bcrypt
npm WARN package.json mongo#0.1.0 No repository field.
npm WARN package.json mongo#0.1.0 No README data
-
> bcrypt#0.8.0 install /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
> node-gyp rebuild
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! bcrypt#0.8.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.0 install script.
npm ERR! 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-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "--save" "bcrypt"
npm ERR! cwd /Users/regan/lighthouse/buddha-bar
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
regan#the-Voyagur buddha-bar (feature/styles) $ xcode-select --print-path
/Library/Developer/CommandLineTools
OP managed to fix this for themselves with:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
but graciously accepted my answer anyway.
Original answer below:
There are two distinct problems here. One is that your node is slightly out of date and your npm is substantially out of date.
You're using OSX, so there are a number of popular ways to manage different node versions. Here's a guide on updating node https://github.com/npm/npm/wiki/Troubleshooting#updating-node-on-osx
Then you'll want to update to the latest npm:
npm install -g npm#latest
Finally, it looks like although you have XCode installed, something is still awry. You report that this command yields
$ xcode-select --print-path
/Library/Developer/CommandLineTools
On my system, which is OSX/Yosemite and can build native addon modules, I see
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
You may need to switch your xcode path to a different directory. For starters, though, please update to the current node and npm tools and try the installation again; if it still fails, the least dangerous next thing to try is
xcode-select --install
If none of that fixes things, let me know and I'll try to help further.
I was having a similar issue but with a different package.
node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
Running macOS Catalina 10.15.2, I tried the following:
$ xcode-select --install
xcode-select: error: command line tools are already installed,
use "Software Update" to install updates
Fixed it by doing the following:
$ [sudo] xcode-select --reset
Hope this helps someone in the future.
EDIT
If someone is still running into issues, there's a thread on GitHub that has other solutions worth trying:
github.com/schnerd/d3-scale-cluster/issues
I had a simliar problem. Solving it was simple in the end.
Just had to run
xcode-select --install
to install the newest tools and then
sudo xcodebuild -license
to agree to the new License terms. Afterwards bcrypt got installed without any problems.
If sudo xcode-select --switch $(xcode-select -print-path) does not work for you, try re-install xcode:
$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install
See more: https://github.com/nodejs/node-gyp/issues/569
I managed to solve this by just opening Xcode, going to Preferences -> Locations -> Command Line Tools, and choosing it from the drop-down (it was empty before).
Following these steps helped me to resolve this issue on MacOS
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp
Install xcode from(I prefer) https://developer.apple.com/download/more/ or xcode-select --install on terminal.
Then follow in order.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp

Resources