Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Can't build node-sass behind a proxy #2939

Closed
descl opened this issue Jul 2, 2020 · 4 comments
Closed

Can't build node-sass behind a proxy #2939

descl opened this issue Jul 2, 2020 · 4 comments

Comments

@descl
Copy link

descl commented Jul 2, 2020

Hello we are trying to build our project behind a proxy and we think that npm set dist-url ${NODEJS_PROXY} is not taken in consideration during the compilation of node-sass? it always tries to access internet in order to download the dependencies

Thanks, Christophe

The error we have during the build:

ERROR:
 
npm info lifecycle [email protected]~postinstall: [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]
> [email protected] postinstall /var/opt/client/node_modules/node-sass
> node scripts/build.js
Building: /usr/local/bin/node /var/opt/client/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/var/opt/client/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.13
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 13.8.0
gyp verb command install [ '13.8.0' ]
gyp verb install input version string "13.8.0"
gyp verb install installing version: 13.8.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 13.8.0
gyp verb ensuring nodedir is created /root/.node-gyp/13.8.0
gyp verb created nodedir /root/.node-gyp/13.8.0
gyp http GET https://nodejs.org/download/release/v13.8.0/node-v13.8.0-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp verb command remove [ '13.8.0' ]
gyp verb remove using node-gyp dir: /root/.node-gyp
gyp verb remove removing target version: 13.8.0
gyp verb remove removing development files for version: 13.8.0
gyp ERR! configure error
gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and
gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad
gyp ERR! stack network settings.
gyp ERR! stack     at Request.<anonymous> (/var/opt/client/node_modules/node-gyp/lib/install.js:197:21)
gyp ERR! stack     at Request.emit (events.js:321:20)
gyp ERR! stack     at Request.onRequestError (/var/opt/client/node_modules/request/request.js:877:8)
gyp ERR! stack     at ClientRequest.emit (events.js:321:20)
gyp ERR! stack     at TLSSocket.socketErrorListener (_http_client.js:432:9)
gyp ERR! stack     at TLSSocket.emit (events.js:321:20)
gyp ERR! stack     at emitErrorNT (internal/streams/destroy.js:84:8)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
gyp ERR! System Linux 4.19.0-9-amd64
gyp ERR! command "/usr/local/bin/node" "/var/opt/client/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /var/opt/client/node_modules/node-sass
gyp ERR! node -v v13.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm verb lifecycle [email protected]~postinstall: unsafe-perm in lifecycle false
npm verb lifecycle [email protected]~postinstall: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/opt/client/node_modules/node-sass/node_modules/.bin:/var/opt/client/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
npm verb lifecycle [email protected]~postinstall: CWD: /var/opt/client/node_modules/node-sass
npm info lifecycle [email protected]~postinstall: Failed to exec postinstall script
npm timing action:postinstall Completed in 46177ms
npm verb unlock done using /root/.npm/_locks/staging-d67fdf191863581d.lock for /var/opt/client/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 290ms
npm timing stage:runTopLevelLifecycles Completed in 116551ms
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.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 verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"<8.10.0"} (current: {"node":"13.8.0","npm":"6.13.6"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm verb notsup Not compatible with your version of node/npm: [email protected]
npm verb notsup Required: {"node":"<8.10.0"}
npm verb notsup Actual:   {"npm":"6.13.6","node":"13.8.0"}
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/watchpack/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 verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/karma/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 verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN @asymmetrik/[email protected] requires a peer of @angular/core@>=8 but none is installed. You must install peer dependencies yourself.
npm WARN @asymmetrik/[email protected] requires a peer of @angular/common@>=8 but none is installed. You must install peer dependencies yourself.
npm WARN @ngrx/[email protected] requires a peer of @ngrx/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @ngrx/[email protected] requires a peer of @ngrx/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @ngrx/[email protected] requires a peer of @ngrx/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @swimlane/[email protected] requires a peer of @types/dragula@^2.1.33 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^5.5.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of leaflet@~1.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/compiler@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-browser-dynamic@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/material@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/cdk@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/animations@>=8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of core-js@>=3.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^8.2.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^8.2.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of debug@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular-devkit/build-angular/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm verb optional SKIPPING OPTIONAL DEPENDENCY:
npm verb optional Failed at the [email protected] postinstall script.
npm verb optional SKIPPING OPTIONAL DEPENDENCY: This is probably not a problem with npm. There is likely additional logging output above.
npm verb stack Error: [email protected] postinstall: `node scripts/build.js`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:321:20)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:321:20)
npm verb stack     at maybeClose (internal/child_process.js:1026:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
npm verb pkgid [email protected]
npm verb cwd /var/opt/client
npm verb Linux 4.19.0-9-amd64
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--verbose"
npm verb node v13.8.0
npm verb npm  v6.13.6
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 118118ms
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-18T10_05_42_375Z-debug.log

Some datas about our version:

  • NPM version (npm -v):6.13.4
  • Node version (node -v):v12.16.1
  • Node Process (node -p process.versions):
    { node: '12.16.1', v8: '7.8.279.23-node.31', uv: '1.34.0', zlib: '1.2.11', brotli: '1.0.7', ares: '1.15.0', modules: '72', nghttp2: '1.40.0', napi: '5', llhttp: '2.0.4', http_parser: '2.9.3', openssl: '1.1.1d', cldr: '35.1', icu: '64.2', tz: '2019c', unicode: '12.1' }
  • Node Platform (node -p process.platform): linux
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): Error: Cannot find module 'node-sass'
  • npm node-sass versions (npm ls node-sass): ***@6.2.6 /var/opt/client -- UNMET DEPENDENCY [email protected]
@nschonni
Copy link
Contributor

nschonni commented Jul 2, 2020

dist-url appears to be related to headers for node-gyp based on the hit I found https://www.electronjs.org/docs/tutorial/using-native-node-modules
If you're working behind a proxy, see the instructions in the TROUBLESHOOTING guide https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#proxy-issues

@kemaakpala
Copy link

kemaakpala commented Jul 3, 2020

@descl to resolve this issue I had to follow the instructions as mentioned in the trouble shooting guide and also run my project on node version 14. i hope this helps.
@nschonni although this fixed the issue for my colleague it's not really ideal as the project is meant to run on node version 10.18.0.
and we were not planning on updating node-sass and our node version any time soon, is it worth checking the new release to see if there is some issue with it. because i'd expect the version of node sass i'm using 4.12.0 to work when running npm i for the first time and not have to update it to 4.14.0 and also switch my node version to 14 as well.

@alhassane
Copy link

In fact, we are trying to build our project behind a proxy and behind nexus from docker. We do not have internet. The command is as follows:

docker build
--build-arg NPM_PROXY=http://proxy.my.fr:8000
--build-arg REGISTRY=registry.my.fr
--build-arg NPM_REGISTRY=http://nexus.my.fr/repository/npm-proxy/
--build-arg NODEJS_REGISTRY=http://nexus.my.fr/repository/nodejs-proxy/
.

The dockerfile is as follows:

ARG REGISTRY
FROM NODE:14

COPY ./client /var/opt/client

WORKDIRE

WORKDIR /var/opt/client

ARG NPM_PROXY=
ARG NPM_REGISTRY=https://registry.npmjs.org/
ARG NODEJS_REGISTRY=https://nodejs.org/download/release/
RUN
npm config set registry ${NPM_REGISTRY} &&
npm config set strict-ssl false &&
npm config set dist-url ${NODEJS_REGISTRY} &&
if [ ! -z "${NPM_PROXY}" ]; then
npm config set proxy ${NPM_PROXY} &&
npm config set https-proxy ${NPM_PROXY};
fi &&
npm install -g --unsafe-perm=true --verbose &&
npm run-script version; \

The error we have during the build is already the same as above.

@saper
Copy link
Member

saper commented Jul 11, 2020

If this is a problem, it is an issue in node-gyp. You can always download and install the header files and have things working. (OP says they are running v12.16.1 but node-gyp tries to download for v13.8.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants