【问题标题】:How to install grpc-tools js package on ubuntu 18.04 with npm如何使用 npm 在 ubuntu 18.04 上安装 grpc-tools js 包
【发布时间】:2021-04-15 18:36:37
【问题描述】:

我正在尝试使用npmubuntu 18.04 上安装grpc-tools 软件包。但是出现了错误。在ubuntu 20.04 上一切正常。如何在ubuntu 18.04上安装?

我有 Dockerfile:

FROM ubuntu:18.04
RUN apt update && apt install -y --no-install-recommends nodejs npm
RUN npm config set strict-ssl false
RUN npm install grpc-tools@1.11.0

我是这样构建 docker 的:

docker build .

得到一个错误:

Step 4/4 : RUN npm install grpc-tools@1.11.0
 ---> Running in 77d9132ac6af
npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

> grpc-tools@1.11.0 install /node_modules/grpc-tools
> node-pre-gyp install

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: unable to get local issuer certificate
node-pre-gyp ERR! stack     at TLSSocket.<anonymous> (_tls_wrap.js:1105:38)
node-pre-gyp ERR! stack     at emitNone (events.js:106:13)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:208:7)
node-pre-gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:639:8)
node-pre-gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38)
node-pre-gyp ERR! System Linux 5.4.0-40-generic
node-pre-gyp ERR! command "/usr/bin/node" "/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /node_modules/grpc-tools
node-pre-gyp ERR! node -v v8.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.15.0
node-pre-gyp ERR! not ok 
unable to get local issuer certificate
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.
npm ERR! Linux 5.4.0-40-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "grpc-tools@1.11.0"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! grpc-tools@1.11.0 install: `node-pre-gyp install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the grpc-tools@1.11.0 install script 'node-pre-gyp install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the grpc-tools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs grpc-tools
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls grpc-tools
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
The command '/bin/sh -c npm install grpc-tools@1.11.0' returned a non-zero code: 1

【问题讨论】:

    标签: node.js docker npm grpc ubuntu-18.04


    【解决方案1】:

    问题是ubuntu 18.04 中的默认node 版本太旧。你可以更新node

    npm cache clean -f
    npm install -g n
    n stable
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-26
      • 2020-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多