Qld-Health-Online-Team / design-system

11 stars 7 forks source link

npm install error. #161

Closed alfredlinson closed 1 month ago

alfredlinson commented 2 months ago

I encountered an error while running npm install (running the terminal as admin user). Below are the details:

Node Version: v20.14.0 NPM Version: 10.7.0

I have already configured proxy settings for npm and the Windows environment variable. I was able to run npm install for other projects without any issues.

Error Log:

npm ERR! code 1
npm ERR! path C:\Users\****\Workspace\FrontendWorkspace\Samples\design-system\node_modules\node-jq
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run install-binary
npm ERR! > node-jq@2.3.5 install-binary
npm ERR! > node scripts/install-binary.js
npm ERR!
npm ERR! C:\Users\****\Workspace\FrontendWorkspace\Samples\design-system\node_modules\node-jq\bin directory was created
npm ERR! Downloading jq from https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe
npm ERR! Error: connect ETIMEDOUT 4.237.22.38:443
npm ERR!     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16) {
npm ERR!   errno: -4039,
npm ERR!   code: 'ETIMEDOUT',
npm ERR!   syscall: 'connect',
npm ERR!   address: '4.237.22.38',
npm ERR!   port: 443
npm ERR! }

Questions:

Any suggestions to resolve this issue? Is it mandatory to use the Node and NPM versions mentioned in the repository’s README?

Note: In my personal laptop it worked fine, there was no issues related to npm i. So I believe only issue related is to do the installation inside corporate proxy environment.

Sandeep-U-Singh commented 2 months ago

This seems Permission Access issue to download from https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe

alfredlinson commented 1 month ago

I resolved the issue as per the document mentioned here.

https://github.com/sanack/node-jq?tab=readme-ov-file#advanced-installation

Advanced installation

By default, node-jq downloads jq during the installation process with a post-install script. Depending on your SO downloads from [https://github.com/jqlang/jq/releases] into ./node_modules/node-jq/bin/jq to avoid colisions with any global installation. Check #161 #167 #171 for more information. You can safely rely on this location for your installed jq, we won't change this path without a major version upgrade.

If you want to skip the installation step of jq, you can set NODE_JQ_SKIP_INSTALL_BINARY to true or ignore the post-install script from the installation npm install node-jq --ignore-scripts.

export NODE_JQ_SKIP_INSTALL_BINARY=true
npm install node-jq
npm install node-jq --ignore-scripts