简体   繁体   中英

npm install node-sass@latest not installed with error : Cannot download “v5.0.0/linux_musl-x64-57_binding.node”:

In my docker file, I tried to create an image. Here is my Dockerfile:

FROM node:8.10.0-alpine
WORKDIR /


ENV GLIBC_VERSION=2.32-r0
ENV JAVA_HOME=/opt/jdk1.8.0_211
ENV JRE_HOME=/opt/jdk1.8.0_211/jre
ENV JAVA_OPTS="-Dfile.encoding=UTF-8"
ENV PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_OPTS:$PATH
ENV NPM_GLOBAL /.npm-global
ENV PATH ${NPM_GLOBAL}/bin:$PATH



RUN apk add --update \
      ca-certificates \
      wget \
      curl \
      git \
      openssh \
      bash && \
    # Install latest glibc
    wget --directory-prefix=/tmp https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \
    apk add --allow-untrusted /tmp/glibc-${GLIBC_VERSION}.apk && \
    wget --directory-prefix=/tmp https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk && \
    apk add --allow-untrusted /tmp/glibc-bin-${GLIBC_VERSION}.apk && \
    wget --directory-prefix=/tmp https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-i18n-${GLIBC_VERSION}.apk && \
    apk --allow-untrusted add /tmp/glibc-i18n-${GLIBC_VERSION}.apk && \
    /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 && \


    
  ...
 
RUN npm cache clear --force
RUN npm install --global yo gulp
RUN npm install --global gulp-cli
RUN npm install --save-dev gulp
RUN npm i --save gulp-ruby-sass
RUN npm install node-sass@latest

RUN npm update
RUN npm rebuild node-sass

The saas installation blocked while trying to download: Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/linux_musl-x64-57_binding.node [91mCannot download "https://github.com/sass/node-sass/releases/download/v5.0.0/linux_musl-x64-57_binding.node":

Which is not available anymore. Look here: https://github.com/sass/node-sass/releases

Here is the output:

Step 19/25 : RUN npm install node-sass@latest
 ---> Running in aff763880e27
[91mnpm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[0m[91mnpm WARN deprecated har-validator@5.1.5: this library is no longer supported
[0m
> node-sass@5.0.0 install /node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/linux_musl-x64-57_binding.node
[91mCannot download "https://github.com/sass/node-sass/releases/download/v5.0.0/linux_musl-x64-57_binding.node": 

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g. 

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080
[0m
> node-sass@5.0.0 postinstall /node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
[91mgyp[0m[91m info it worked if it ends with ok
[0m[91mgyp verb cli [ '/usr/local/bin/node',
[0m[91mgyp verb cli   '/node_modules/node-gyp/bin/node-gyp.js',
gyp [0m[91mverb [0m[91mcli   'rebuild',
gyp verb cli[0m[91m   '--verbose',
[0m[91mgyp verb cli[0m[91m   '--libsass_ext=',
[0m[91mgyp verb cli   '--libsass_cflags=',
gyp verb[0m[91m cli   '--libsass_ldflags=',
gyp[0m[91m verb cli[0m[91m   '--libsass_library=' ]
[0m[91mgyp info using node-gyp@7.1.2
[0m[91mgyp [0m[91minfo using[0m[91m node@8.10.0 | linux | x64
[0m[91mgyp verb command rebuild []
[0m[91mgyp verb command clean []
[0m[91mgyp verb clean removing "build" directory
[0m[91mgyp verb command configure []
[0m[91mgyp verb find Python Python is not set from command line or npm configuration
[0m[91mgyp verb [0m[91mfind Python Python is not set from environment variable PYTHON
[0m[91mgyp verb [0m[91mfind Python checking if "python3" can be used
[0m[91mgyp verb find Python - executing "python3" to get executable path
[0m[91mgyp verb find Python - "python3" is not in PATH or produced an error
gyp [0m[91mverb find Python checking if "python" can be used
gyp verb find Python[0m[91m - executing "python" to get executable path
[0m[91mgyp verb find Python - "python" is not in PATH or produced an error
[0m[91mgyp verb find Python checking if "python2" can be used
gyp verb[0m[91m find Python - executing "python2" to get executable path
[0m[91mgyp verb find Python - "python2" is not in PATH or produced an error
[0m[91mgyp ERR! find Python 
gyp [0m[91mERR! find Python Python is not set from command line or npm configuration
gyp [0m[91mERR![0m[91m find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp[0m[91m ERR! find Python - "python3" is not in PATH or produced an error
gyp[0m[91m [0m[91mERR! [0m[91mfind Python checking if "python" can be used
[0m[91mgyp ERR![0m[91m find Python - "python" is not in PATH or produced an error
[0m[91mgyp [0m[91mERR! find Python checking if "python2" can be used
gyp ERR![0m[91m [0m[91mfind Python - "python2" is not in PATH or produced an error
[0m[91mgyp[0m[91m ERR![0m[91m find Python 
[0m[91mgyp ERR![0m[91m find Python[0m[91m **********************************************************
gyp ERR! [0m[91mfind Python You need to install the latest version of Python.
[0m[91mgyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp[0m[91m ERR! find Python[0m[91m you can try one of the following options:
gyp ERR![0m[91m find Python - Use the switch --python="/path/to/pythonexecutable"
[0m[91mgyp ERR![0m[91m find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! [0m[91mfind Python - Set the npm configuration variable python:
gyp[0m[91m ERR! [0m[91mfind Python   npm config set python "/path/to/pythonexecutable"
gyp ERR![0m[91m find Python[0m[91m For more information consult the documentation at:
gyp ERR![0m[91m find Python https://github.com/nodejs/node-gyp#installation
gyp[0m[91m ERR! find Python[0m[91m **********************************************************
gyp ERR! find Python[0m[91m 
[0m[91mgyp ERR! configure error 
[0m[91mgyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/node_modules/node-gyp/lib/find-python.js:302:47)
[0m[91mgyp ERR! [0m[91mstack     at PythonFinder.runChecks (/node_modules/node-gyp/lib/find-python.js:136:21)
gyp [0m[91mERR! stack     at PythonFinder.<anonymous> (/node_modules/node-gyp/lib/find-python.js:179:16)
[0m[91mgyp [0m[91mERR! [0m[91mstack     at PythonFinder.execFileCallback (/node_modules/node-gyp/lib/find-python.js:266:16)
[0m[91mgyp [0m[91mERR! [0m[91mstack     at exithandler (child_process.js:282:5)
[0m[91mgyp ERR! stack     at ChildProcess.errorhandler (child_process.js:294:5)
[0m[91mgyp ERR![0m[91m stack     at emitOne (events.js:116:13)
[0m[91mgyp ERR! stack     at ChildProcess.emit (events.js:211:7)
gyp[0m[91m ERR! [0m[91mstack     at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
[0m[91mgyp ERR![0m[91m stack     at onErrorNT (internal/child_process.js:372:16)
[0m[91mgyp ERR! [0m[91mSystem Linux 4.15.0-1087-gcp
[0m[91mgyp ERR! command "/usr/local/bin/node" "/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
[0m[91mgyp ERR! [0m[91mcwd[0m[91m /node_modules/node-sass
[0m[91mgyp ERR! node -v v8.10.0
[0m[91mgyp ERR! [0m[91mnode-gyp -v v7.1.2
[0m[91mgyp ERR! not ok 
[0m[91mBuild failed with error code: 1
[0m[91mnpm WARN enoent ENOENT: no such file or directory, open '/package.json'
[0m[91mnpm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN[0m[91m !invalid#1 No README data
npm WARN !invalid#1 No license field.
[0m[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0m[91m
[0m[91mnpm ERR! code ELIFECYCLE
[0m[91mnpm ERR! errno 1
[0m[91mnpm ERR! node-sass@5.0.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR![0m[91m 
npm ERR! Failed at the node-sass@5.0.0 postinstall script.
npm[0m[91m ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0m[91m
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-02-19T13_12_12_157Z-debug.log
[0mThe command '/bin/sh -c npm install node-sass@latest' returned a non-zero code: 1
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Push Image)
Stage "Push Image" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

How can I specify this step?

RUN npm install node-sass@latest

Thanks in advance.

node-sass v5 no longer supports Node 8, as it is EOL https://github.com/sass/node-sass#node-version-support-policy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM