bcrypt install `node-pre-gyp install --fallback-to-build`

不打扰是莪最后的温柔 提交于 2021-02-13 11:01:14

 npm安装parse-server的过程中遇到了2次错误

尝试1

ganiks@ganiks-ubuntu-trusty-64:~$ sudo npm i -g parse-server
npm WARN deprecated uws@10.148.1: stop using this version
/usr/bin/parse-server -> /usr/lib/node_modules/parse-server/bin/parse-server

> bcrypt@3.0.3 install /usr/lib/node_modules/parse-server/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.3 and node@8.15.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/ganiks/.node-gyp/8.15.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/parse-server/node_modules/bcrypt/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/parse-server/node_modules/bcrypt/.node-gyp'
gyp ERR! System Linux 3.13.0-164-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /usr/lib/node_modules/parse-server/node_modules/bcrypt
gyp ERR! node -v v8.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/parse-server/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 3.13.0-164-generic
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/parse-server/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/parse-server/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)

> parse-server@3.1.3 postinstall /usr/lib/node_modules/parse-server
> node -p 'require("./postinstall.js")()'


                  1111111111
               1111111111111111
            1111111111111111111111
          11111111111111111111111111
        111111111111111       11111111
       1111111111111             111111
      1111111111111   111111111   111111
      111111111111   11111111111   111111
     1111111111111   11111111111   111111
     1111111111111   1111111111    111111
     1111111111111111111111111    1111111
     11111111                    11111111
      111111         1111111111111111111
      11111   11111  111111111111111111
       11111         11111111111111111
        111111     111111111111111111
          11111111111111111111111111
            1111111111111111111111
              111111111111111111
                  11111111111


        Thanks for installing parse 🙏
  Please consider donating to our open collective
      to help us maintain this package.

  👉 https://opencollective.com/parse-server

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.3 (node_modules/parse-server/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.3 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ parse-server@3.1.3
added 281 packages from 349 contributors in 88.007s

这一次安装部分成功(281 packages)

因为 在包bcrypt的安装途中出错:

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/ganiks/.node-gyp/8.15.0"

解决方案参看:

https://www.cnblogs.com/ganiks/p/stack-error-eacces-denied-node-gyp.html

 

尝试2

# 卸载掉刚才不完整的安装
ganiks@ganiks-ubuntu-trusty-64:~$ sudo npm un -g parse-server
removed 281 packages in 4.029s

# 尝试2,加上参数 --unsafe-perm
ganiks@ganiks-ubuntu-trusty-64:~$ sudo npm i -g parse-server --unsafe-perm
npm WARN deprecated uws@10.148.1: stop using this version
/usr/bin/parse-server -> /usr/lib/node_modules/parse-server/bin/parse-server

> bcrypt@3.0.3 install /usr/lib/node_modules/parse-server/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download

node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.3 and node@8.15.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error connect ETIMEDOUT 54.231.80.224:443
make: Entering directory `/usr/lib/node_modules/parse-server/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
make: g++: Command not found
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
make: Leaving directory `/usr/lib/node_modules/parse-server/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 3.13.0-164-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /usr/lib/node_modules/parse-server/node_modules/bcrypt
gyp ERR! node -v v8.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/parse-server/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 3.13.0-164-generic
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/parse-server/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/parse-server/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)

> parse-server@3.1.3 postinstall /usr/lib/node_modules/parse-server
> node -p 'require("./postinstall.js")()'


                  1111111111
               1111111111111111
            1111111111111111111111
          11111111111111111111111111
        111111111111111       11111111
       1111111111111             111111
      1111111111111   111111111   111111
      111111111111   11111111111   111111
     1111111111111   11111111111   111111
     1111111111111   1111111111    111111
     1111111111111111111111111    1111111
     11111111                    11111111
      111111         1111111111111111111
      11111   11111  111111111111111111
       11111         11111111111111111
        111111     111111111111111111
          11111111111111111111111111
            1111111111111111111111
              111111111111111111
                  11111111111


        Thanks for installing parse 🙏
  Please consider donating to our open collective
      to help us maintain this package.

  👉 https://opencollective.com/parse-server

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.3 (node_modules/parse-server/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.3 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ parse-server@3.1.3
added 281 packages from 349 contributors in 155.531s

还是没有成功,安装结果跟尝试1是一样的,但是报错信息不同

node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.3 and node@8.15.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)

参考资料:

https://stackoverflow.com/questions/33463945/node-pre-gyp-install-fallback-to-build-failed-during-meanjs-installation-on

先升级下 node-gyp

尝试3

ganiks@ganiks-ubuntu-trusty-64:~$ sudo npm i -g node-gyp
/usr/bin/node-gyp -> /usr/lib/node_modules/node-gyp/bin/node-gyp.js
+ node-gyp@3.8.0
added 97 packages from 67 contributors in 7.194s



ganiks@ganiks-ubuntu-trusty-64:~$ sudo npm un -g parse-server
removed 281 packages in 5.307s
ganiks@ganiks-ubuntu-trusty-64:~$ sudo npm i -g parse-server --unsafe-perm
npm WARN deprecated uws@10.148.1: stop using this version
/usr/bin/parse-server -> /usr/lib/node_modules/parse-server/bin/parse-server

> bcrypt@3.0.3 install /usr/lib/node_modules/parse-server/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
[bcrypt] Success: "/usr/lib/node_modules/parse-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote

> parse-server@3.1.3 postinstall /usr/lib/node_modules/parse-server
> node -p 'require("./postinstall.js")()'


                  1111111111
               1111111111111111
            1111111111111111111111
          11111111111111111111111111
        111111111111111       11111111
       1111111111111             111111
      1111111111111   111111111   111111
      111111111111   11111111111   111111
     1111111111111   11111111111   111111
     1111111111111   1111111111    111111
     1111111111111111111111111    1111111
     11111111                    11111111
      111111         1111111111111111111
      11111   11111  111111111111111111
       11111         11111111111111111
        111111     111111111111111111
          11111111111111111111111111
            1111111111111111111111
              111111111111111111
                  11111111111


        Thanks for installing parse 🙏
  Please consider donating to our open collective
      to help us maintain this package.

  👉 https://opencollective.com/parse-server

  + parse-server@3.1.3
added 352 packages from 382 contributors in 21.176s

安装成功(352packages)

 

关于node-gyp

https://www.npmjs.com/package/node-gyp

node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js.

It bundles the gyp project used by the Chromium team and takes away the pain of dealing with the various differences in build platforms.

It is the replacement to the node-waf program which is removed for node v0.8.

If you have a native addon for node that still has a wscript file, then you should definitely add a binding.gyp file to support the latest versions of node.

Multiple target versions of node are supported (i.e. 0.8, ..., 456, etc.), regardless of what version of node is actually installed on your system (node-gyp downloads the necessary development files or headers for the target version).

 

原文出处:https://www.cnblogs.com/ganiks/p/node-pre-gyp-install-fallback-to-build-failed-during-parse-server-installation.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!