Sharp: ERR! sharp getaddrinfo ENOTFOUND hostname

Created on 7 Jul 2020  ยท  7Comments  ยท  Source: lovell/sharp

I have been trying to install Strapi since few days but getting this sharp error tried many solution but nothing worked. i dont think i have any directory which has white spaces. I also raised an issue in strapi repo too but havent got any solution yet.

Output of npm install --unsafe-perm flag :

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated @formatjs/[email protected]: We have renamed the package to @formatjs/intl-numberformat
npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: This project is unmaintained
npm WARN deprecated [email protected]: This project is unmaintained
npm WARN rm not removing /home/normal/Desktop/strapiPrjA/node_modules/.bin/semver as it wasn't installed by /home/normal/Desktop/strapiPrjA/node_modules/semver
npm WARN rm not removing /home/normal/Desktop/strapiPrjA/node_modules/.bin/nopt as it wasn't installed by /home/normal/Desktop/strapiPrjA/node_modules/nopt
npm WARN rm not removing /home/normal/Desktop/strapiPrjA/node_modules/.bin/json5 as it wasn't installed by /home/normal/Desktop/strapiPrjA/node_modules/json5

> [email protected] install /home/normal/Desktop/strapiPrjA/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://hostname/path/libvips-8.9.0-linux-x64.tar.gz
ERR! sharp getaddrinfo ENOTFOUND hostname
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
make: Entering directory '/home/normal/Desktop/strapiPrjA/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:25:
/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
 #include <glib-object.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [sharp.target.mk:135: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/normal/Desktop/strapiPrjA/node_modules/sharp/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/normal/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.0-6-amd64
gyp ERR! command "/home/normal/.nvm/versions/node/v12.14.1/bin/node" "/home/normal/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/normal/Desktop/strapiPrjA/node_modules/sharp
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"<8.10.0"} (current: {"node":"12.14.1","npm":"6.14.5"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of knex@^0.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/normal/.npm/_logs/2020-07-07T15_11_42_571Z-debug.log

2020-07-07T14_56_59_774Z-debug.log

Output of running npx envinfo --binaries --system

```npx: installed 1 in 1.577s

System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (4) x64 Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
Memory: 4.32 GB / 7.71 GB
Container: Yes
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
Yarn: 1.21.1 - /usr/bin/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v12.14.1/bin/npm

```

installation

Most helpful comment

Something or someone must have explicitly set sharp_dist_base_url on this machine to this invalid value, hence the error you're seeing at install time.

Run npm config delete sharp_dist_base_url to remove this, then try installing again.

All 7 comments

The salient part of this log is:

info sharp Downloading https://hostname/path/libvips-8.9.0-linux-x64.tar.gz
ERR! sharp getaddrinfo ENOTFOUND hostname
info sharp Attempting to build from source via node-gyp but this may fail due to the above error

It looks like there's an environment variable set to https://hostname/path/ that is overriding the URL used to fetch prebuilt binaries.

What is the output of running env | grep -i sharp at the command line?

The salient part of this log is:

info sharp Downloading https://hostname/path/libvips-8.9.0-linux-x64.tar.gz
ERR! sharp getaddrinfo ENOTFOUND hostname
info sharp Attempting to build from source via node-gyp but this may fail due to the above error

It looks like there's an environment variable set to https://hostname/path/ that is overriding the URL used to fetch prebuilt binaries.

What is the output of running env | grep -i sharp at the command line?

@lovell it is not showing anything after running env | grep -i sharp at the command line

Thanks, what is the output of running npm config list | grep -i sharp at the command line?

Thanks, what is the output of running npm config list | grep -i sharp at the command line?

thanks @lovell , here is the Output :
sharp_dist_base_url = "https://hostname/path/"

Something or someone must have explicitly set sharp_dist_base_url on this machine to this invalid value, hence the error you're seeing at install time.

Run npm config delete sharp_dist_base_url to remove this, then try installing again.

Something or someone must have explicitly set sharp_dist_base_url on this machine to this invalid value, hence the error you're seeing at install time.

Run npm config delete sharp_dist_base_url to remove this, then try installing again.

thanks @lovell i guess it solved sharp error,but got another error.

yarn install v1.21.1
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
warning strapi > [email protected]: This module has moved and is now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
warning strapi > boom > [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
warning strapi-admin > webpack-dev-server > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning strapi-admin > webpack-dev-server > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
info There appears to be trouble with your network connection. Retrying...
warning strapi-admin > @babel/polyfill > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning strapi-admin > react-virtualized > babel-runtime > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning strapi-admin > react-intl > @formatjs/[email protected]: We have renamed the package to @formatjs/intl-numberformat
warning strapi-admin > reactstrap > react-popper > [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
info There appears to be trouble with your network connection. Retrying...
warning strapi-admin > webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning strapi-admin > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning strapi-admin > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
warning strapi-plugin-content-manager > draft-js > fbjs > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning strapi-plugin-users-permissions > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning strapi-plugin-email > strapi-provider-email-sendmail > sendmail > [email protected]: This project is unmaintained
warning strapi-plugin-email > strapi-provider-email-sendmail > sendmail > mailcomposer > [email protected]: This project is unmaintained
warning sqlite3 > node-gyp > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "strapi-admin > [email protected]" has unmet peer dependency "[email protected] - 3".
warning "strapi-admin > [email protected]" has unmet peer dependency "popper.js@^1.16.0".
warning "strapi-admin > @buffetjs/core > [email protected]" has unmet peer dependency "react-with-direction@^1.3.1".
warning "strapi-plugin-users-permissions > [email protected]" has unmet peer dependency "koa@>=2.0.0".
warning " > [email protected]" has incorrect peer dependency "knex@^0.20.0".
[5/5] Building fresh packages...
[-/4] โ   waiting...
[-/4] โ   waiting...
[3/4] โ  sharp
error /home/normal/Desktop/strapiTest/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /home/normal/Desktop/strapiTest/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for "/home/normal/Desktop/strapiTest/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error connect ETIMEDOUT 52.216.224.72:443 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://nodejs.org/download/release/v12.14.1/node-v12.14.1-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: connect ETIMEDOUT 104.20.23.46:443
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16)
gyp ERR! System Linux 4.19.0-6-amd64
gyp ERR! command "/home/normal/.nvm/versions/node/v12.14.1/bin/node" "/home/normal/Desktop/strapiTest/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/normal/Desktop/strapiTest/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/normal/Desktop/strapiTest/node_modules/sqlite3/lib/binding/napi-v3-linux-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /home/normal/Desktop/strapiTest/node_modules/sqlite3
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/normal/.nvm/versions/node/v12.14.1/bin/node /home/normal/Desktop/strapiTest/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/normal/Desktop/strapiTest/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/normal/Desktop/strapiTest/node_modules/sqlite3/lib/binding/napi-v3-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/normal/Desktop/strapiTest/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 4.19.0-6-amd64
node-pre-gyp ERR! command "/home/normal/.nvm/versions/node/v12.14.1/bin/node" "/home/normal/Desktop/strapiTest/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/normal/Desktop/strapiTest/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.14.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/home/normal/.nvm/versions/node/v12.14.1/bin/node /home/normal/Desktop/strapiTest/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/normal/Desktop/strapiTest/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node --module_name=node_sqli

It looks like there are (temporary?) networking errors downloading sqlite3, which is not a dependency of and therefore unrelated to sharp.

node-pre-gyp WARN Hit error connect ETIMEDOUT 52.216.224.72:443
gyp ERR! stack Error: connect ETIMEDOUT 104.20.23.46:443

Good luck!

Was this page helpful?
0 / 5 - 0 ratings