npm install node-curl – Failed at the node-curl@0.3.3 install



So I encounter this error while installing node-curl on nodejs v4.2.6 and npm 3.5.2 on Ubuntu 16.04.

Below is the entire npm log:

> node-curl@0.3.3 install /path/to/dir/node_modules/node-curl
> sh src/generate_curl_options_list.sh && (node-gyp rebuild || node-waf configure build)

extract constants from 
generate src/integer_options.h
cat: '': No such file or directory
generate src/string_options.h
cat: '': No such file or directory
generate src/integer_infos.h
cat: '': No such file or directory
generate src/string_infos.h
cat: '': No such file or directory
generate src/double_infos.h
cat: '': No such file or directory
make: Entering directory '/path/to/dir/node_modules/node-curl/build'
  CXX(target) Release/obj.target/node-curl/src/node-curl.o
In file included from ../src/node-curl.cc:1:0:
../src/node-curl.h:7:23: fatal error: curl/curl.h: No such file or directory
compilation terminated.
node-curl.target.mk:104: recipe for target 'Release/obj.target/node-curl/src/node-curl.o' failed
make: *** [Release/obj.target/node-curl/src/node-curl.o] Error 1
make: Leaving directory '/path/to/dir/node_modules/node-curl/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-24-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /path/to/dir/node_modules/node-curl
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
sh: 1: node-waf: not found
nw-demo@0.0.1 /path/to/dir/
└── request@2.72.0  extraneous

npm WARN nw-demo@0.0.1 No description
npm WARN nw-demo@0.0.1 No repository field.
npm WARN nw-demo@0.0.1 No license field.
npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-curl"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! node-curl@0.3.3 install: `sh src/generate_curl_options_list.sh && (node-gyp rebuild || node-waf configure build)`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the node-curl@0.3.3 install script 'sh src/generate_curl_options_list.sh && (node-gyp rebuild || node-waf configure 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 node-curl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     sh src/generate_curl_options_list.sh && (node-gyp rebuild || node-waf configure build)
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-curl
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-curl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /path/to/dir/npm-debug.log

So I search the web for solutions and somehow I found one. It turns out that node-curl requires you to install libcurl-dev but it’s nowhere to be seen in it’s documentation.

Anyway, so I go ahead and install libcurl-dev.

sudo apt-get install libcurl4-openssl-dev

It seems like it fixes the error I have, but it gives another error. Something like v8 engine error. So I search the web again for another solution. It takes me hours of reading posts and stuff until I stumble upon an issue on github where it says node-curl is dead 2 years ago.

I was like “I spent hours on fixing stuff for a dead package”. But there’s nothing I can do about it, so I started to look for an alternative. And luckily I found two packages that I can use for my project! 😀

Check out this two node packages that can be a replacement for node-curl:
node-libcurl
request

I hope this post helped you! Happy coding! 😀