4

I am trying to setup a Strapi project on my corporate laptop. When I run the command npm i it installs the some modules and when it finally reaches

> sharp@0.26.2 install C:\<path>\Documents\Office\km-service\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

I get these errors:

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-win32-x64.tar.brERR! sharp self signed certificate in certificate chain
sharp Attempting to build from source via node-gyp but this may fail due to the above error
sharp Please see https://sharp.pixelplumbing.com/install for required dependencies

C:\<path>\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\<path>\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\<path>AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
WARN install got an error, rolling back install
gyp ERR! configure error   
gyp ERR! stack Error: self signed certificate in certificate chain
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1321:34)
gyp ERR! stack     at TLSSocket.emit (events.js:210:5)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:794:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:608:12
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\<path>\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\<path>\node_modules\sharp

I have tried the following things but the issue hasn't been fixed yet.

npm config set registry http://registry.npmjs.org/
npm install npm -g --ca=null
npm config set ca=""
npm set strict-ssl false
npm set config set NODE_TLS_REJECT_UNAUTHORIZED=0

I have python 3.9.0 installed on my system and I did install windows-build-tools via npm.

Aditya Priyam
  • 156
  • 1
  • 11

1 Answers1

1

A possible workaround is to manually download the libvips library (use the URL from error description) and place it in global cache folder/_libvips directory (i.e., on Windows the folder is %AppData%/npm-cache/_libvips).
The install task will then use the cached file instead of downloading it.

Originally suggested here.

Alex Lipov
  • 13,503
  • 5
  • 64
  • 87