Node pre gyp err build error

Node Version: 11.0.0 NPM Version: 6.4.1 Platform: Darwin prabal-ADFGs-MacBook-Pro.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_6...

did that but still getting errors
C:UsersadminJPMC-tech-task-2>npm install

bufferutil@3.0.5 install C:UsersadminJPMC-tech-task-2node_modulesbufferutil
prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=11.0.0 runtime=node arch=x64 platform=win32)

C:UsersadminJPMC-tech-task-2node_modulesbufferutil>if not defined npm_config_node_gyp (node «C:UsersadminAppDataRoamingnvmv11.0.0node_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin….node_modulesnode-gypbinnode-gyp.js» rebuild ) else (node «C:UsersadminAppDataRoamingnvmv11.0.0node_modulesnpmnode_modulesnode-gypbinnode-gyp.js» rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:UsersadminAppDataLocalProgramsPythonPython38-32python.EXE -c import sys; print «%s.%s.%s» % sys.version_info[:3];
gyp ERR! stack File «», line 1
gyp ERR! stack import sys; print «%s.%s.%s» % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:381:11)
gyp ERR! stack at Socket.emit (events.js:182:13)
gyp ERR! stack at Pipe._handle.close (net.js:611:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command «C:Program Filesnodejsnode.exe» «C:UsersadminAppDataRoamingnvmv11.0.0node_modulesnpmnode_modulesnode-gypbinnode-gyp.js» «rebuild»
gyp ERR! cwd C:UsersadminJPMC-tech-task-2node_modulesbufferutil
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN bootstrap@4.2.1 requires a peer of jquery@1.9.1 — 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.2.1 requires a peer of popper.js@^1.14.6 but none is installed. You must install peer dependencies yourself.
npm WARN extract-text-webpack-plugin@3.0.2 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {«os»:»darwin»,»arch»:»any»} (current: {«os»:»win32″,»arch»:»x64″})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bufferutil@3.0.5 install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@3.0.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersadminAppDataRoamingnpm-cache_logs2020-06-06T17_50_38_760Z-debug.log

C:UsersadminJPMC-tech-task-2>npm install —build-from-resource

bufferutil@3.0.5 install C:UsersadminJPMC-tech-task-2node_modulesbufferutil
prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=11.0.0 runtime=node arch=x64 platform=win32)

C:UsersadminJPMC-tech-task-2node_modulesbufferutil>if not defined npm_config_node_gyp (node «C:UsersadminAppDataRoamingnvmv11.0.0node_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin….node_modulesnode-gypbinnode-gyp.js» rebuild ) else (node «C:UsersadminAppDataRoamingnvmv11.0.0node_modulesnpmnode_modulesnode-gypbinnode-gyp.js» rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:UsersadminAppDataLocalProgramsPythonPython38-32python.EXE -c import sys; print «%s.%s.%s» % sys.version_info[:3];
gyp ERR! stack File «», line 1
gyp ERR! stack import sys; print «%s.%s.%s» % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command «C:Program Filesnodejsnode.exe» «C:UsersadminAppDataRoamingnvmv11.0.0node_modulesnpmnode_modulesnode-gypbinnode-gyp.js» «rebuild»
gyp ERR! cwd C:UsersadminJPMC-tech-task-2node_modulesbufferutil
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN bootstrap@4.2.1 requires a peer of jquery@1.9.1 — 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.2.1 requires a peer of popper.js@^1.14.6 but none is installed. You must install peer dependencies yourself.
npm WARN extract-text-webpack-plugin@3.0.2 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {«os»:»darwin»,»arch»:»any»} (current: {«os»:»win32″,»arch»:»x64″})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bufferutil@3.0.5 install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@3.0.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersadminAppDataRoamingnpm-cache_logs2020-06-06T17_52_09_012Z-debug.log

C:UsersadminJPMC-tech-task-2>

I encountered a series of errors when I tried to run my existing Rails5 app in my freshly installed macOS Mojave.

$ bundle exec rails s

this generated some errors like, node not found, then I installed node using brew.

$ brew install node

then,

$ npm install yarn
$ yarn install 
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/john/projects/sifaris/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/Cellar/node/12.1.0/bin/node" "/Users/john/projects/sifaris/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/john/projects/sifaris/node_modules/node-sass
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
$ bundle exec rails s
=> Booting Puma
=> Rails 5.2.3 application starting in development
=> Run `rails server -h` for more startup options
error Lockfile does not contain pattern: "yarn@^1.15.2"
error Couldn't find an integrity file
error Found 2 errors.


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================

Solution

$ rm yarn.lock
$ yarn cache clean
$ yarn install
$ yarn install v1.15.2

now it installs all the dependencies properly

bundle exec rails s
=> Booting Puma
=> Rails 5.2.3 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.0-p0), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
yarn install v1.15.2

Cover image for Docker Node Alpine Image Build Fails on node-gyp

Jamaluddin Mondal

Docker node:7.9-alpine unable to build package due python is not installed :Resolved

I’m attempting to Dockerize a node.js application(Typescript). I’m using the node:12.18.4-alpine Docker image as a base.

I go this

gyp ERR! configure error

gyp ERR! stack Error: Can’t find Python executable «python», you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:159:21)
gyp ERR! System Linux 3.10.0-957.el7.x86_64
gyp ERR! command «/usr/local/bin/node» «/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js» «configure» «—fallback-to-build» «—module=/code/server/node_modules/bcrypt/lib/binding/bcrypt_lib.node» «—module_name=bcrypt_lib» «—module_path=/code/server/node_modules/bcrypt/lib/binding» «—napi_version=4» «—node_abi_napi=napi» «—napi_build_version=0» «—node_napi_label=node-v67»
gyp ERR! cwd /code/server/node_modules/bcrypt
gyp ERR! node -v v11.9.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/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure —fallback-to-build —module=/code/server/node_modules/bcrypt/lib/binding/bcrypt_lib.node —module_name=bcrypt_lib —module_path=/code/server/node_modules/bcrypt/lib/binding —napi_version=4 —node_abi_napi=napi —napi_build_version=0 —node_napi_label=node-v67’ (1)
node-pre-gyp ERR! stack at ChildProcess. (/code/server/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Linux 3.10.0-957.el7.x86_64
node-pre-gyp ERR! command «/usr/local/bin/node» «/code/server/node_modules/bcrypt/node_modules/.bin/node-pre-gyp» «install» «—fallback-to-build»
node-pre-gyp ERR! cwd /code/server/node_modules/bcrypt
node-pre-gyp ERR! node -v v11.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute ‘/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure —fallback-to-build —module=/code/server/node_modules/bcrypt/lib/binding/bcrypt_lib.node —module_name=bcrypt_lib —module_path=/code/server/node_modules/bcrypt/lib/binding —napi_version=4 —node_abi_napi=napi —napi_build_version=0 —node_napi_label=node-v67’ (1)
npm WARN backend-botmanagementservice@1.0.0 No description
npm WARN backend-botmanagementservice@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {«os»:»darwin»,»arch»:»any»} (current: {«os»:»linux»,»arch»:»x64″})
……..

my docker file was

 #MY first stage, that is the Builder
FROM node:12.18.4 AS ts-sample-builder
WORKDIR /app
COPY . .
RUN npm install
RUN npm run clean
RUN npm run build
# My Second stage, that creates an image for production
FROM node:12.18.4 AS ts-sample-prod
WORKDIR /app
COPY --from=ts-sample-builder ./app/dist ./dist
COPY package* ./
RUN npm install --production
CMD npm run start-prod
EXPOSE 3001

Enter fullscreen mode

Exit fullscreen mode

To reduce image size I change node version node:12.18.4-alpine then it caches issues as I mentioned above.

When using alpine, you need to install build dependencies for some node modules to be able to be built natively. It should probably be documented
Note:
if just use the base as node:12 or any other version your image size will be more than 1GB some cases.

How to speed up Node re-builds by leveraging Docker multi-stage builds
if you are using alpine, you need to install build dependencies for some node module to be able to be built natively.

Example

FROM node:8.12-alpine
EXPOSE 8080
WORKDIR /app
COPY . .
#python
RUN apk add --no-cache --virtual .gyp 
        python 
        make 
        g++ 
    && npm install 
    && apk del .gyp
CMD ["npm", "start"]

Enter fullscreen mode

Exit fullscreen mode

Docker and Node.js Best Practices

Docker and Node.js Best Practices

I will suggest you for checking bcrypt $ bcryptjs npm docs.
node-gyp only works with stable/released versions of node. Since the bcrypt module uses node-gyp to build and install, you’ll need a stable version of node to use bcrypt. If you do not, you’ll likely see an error that starts with:

Alt Text

In the end, It resolves all issues like slow build &Python is not installed &, etc.

#My first stage, that is the Builder
FROM  node:12.18.4-buster AS build
#RUN apk add --update --no-cache 
#    python 
#    make 
#    g++
COPY . .
# If you have native dependencies, you'll need extra tools
RUN npm install
#RUN npm install
RUN npm run build
RUN npm prune --production
#CMD npm run start-prod
#EXPOSE 3001
## My Second stage, that creates an image for production
FROM node:12.18.4-alpine
WORKDIR /app
COPY --from=build ./dist ./dist
COPY --from=build ./node_modules ./node_modules
CMD npm run start-prod
EXPOSE 3001

Enter fullscreen mode

Exit fullscreen mode

It worked for me!

learn more about multi staging.

Using Multi-Stage Builds to Simplify And Standardize Build Processes

Необходимо определиться с версией, которая вам нужна. Я предпочитаю ставить не новейшую версию Node.js, а последнюю LTS.

Установка в Elementary OS, Ubuntu:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

Установка в Debian:

curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs

Инструкции под разные системы и для разных версий от разработчиков.

Проверка версий:

nodejs -v
npm -v

Если для проекта вы делаете:

npm install

И вылезает ошибка, вроде:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/.../node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-42-generic
gyp ERR! command "/usr/bin/node" "/home/.../node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/.../node_modules/node-sass
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.10.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.10.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/d1mon/.npm/_logs/2020-03-31T05_52_52_174Z-debug.log

Необходимо удалить каталог node_modules и файл блокировки package-lock.json, очистить кэш и пробовать заново:

rm -rf node_modules package-lock.json
npm cache clean --force
npm install

Глобальная установка пакетов

Для глобальной установки пакетов в команду добавляется параметр -g. Но это не будет работать по умолчанию из-за проблем с правами доступа, поэтому предварительно требуется сделать следующее.

Создадим каталог для глобальных установок:

mkdir ~/.npm-global

Настройка npm на использование нового каталога:

npm config set prefix '~/.npm-global'

В файл ~/.profile необходимо добавить строку:

export PATH=~/.npm-global/bin:$PATH

В командной строке снова, для применения изменений:

source ~/.profile

На этом все, теперь можно устанавливать пакеты глобально.

13
Thursday
Aug 2020

Problem:
While installing bcrypt I’m getting this error in my linux mint machine, I’m using

  • node v14.7.0
  • bcrypt v1.0.3

Here’s the error:

npm ERR! bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`

Here’s the complete build errors:

> bcrypt@1.0.3 install /home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v83-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@14.7.0 (node-v83 ABI) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v83-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@14.7.0 (node-v83 ABI) (falling back to source compile with node-gyp) 
make: Entering directory '/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
make: Entering directory '/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
sed: can't read ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw: No such file or directory
make: *** [bcrypt_lib.target.mk:113: Release/obj.target/bcrypt_lib/src/blowfish.o] Error 2
make: Leaving directory '/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/armano/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-42-generic
gyp ERR! command "/home/armano/.nvm/versions/node/v14.7.0/bin/node" "/home/armano/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt
gyp ERR! node -v v14.7.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/armano/.nvm/versions/node/v14.7.0/bin/node /home/armano/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack     at ChildProcess. (/home/armano/_node/moleculer-node-realworld-example-app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1051:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.4.0-42-generic
node-pre-gyp ERR! command "/home/armano/.nvm/versions/node/v14.7.0/bin/node" "/home/armano/_node/moleculer-node-realworld-example-app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt
node-pre-gyp ERR! node -v v14.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok 
Failed to execute '/home/armano/.nvm/versions/node/v14.7.0/bin/node /home/armano/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding' (1)
../src/bcrypt.cc: In function ‘void encode_salt(char*, u_int8_t*, u_int16_t, u_int8_t)’:
../src/bcrypt.cc:139:24: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
In file included from /usr/include/stdio.h:867,
                 from ../src/bcrypt.cc:48:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 4 and 5 bytes into a destination of size 4
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/bcrypt.cc: In function ‘void bcrypt(const char*, const char*, char*)’:
../src/bcrypt.cc:270:29: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
In file included from /usr/include/stdio.h:867,
                 from ../src/bcrypt.cc:48:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 4 and 5 bytes into a destination of size 4
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/bcrypt.cc: At global scope:
../src/bcrypt.cc:322:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw: No such file or directory
compilation terminated.
make: *** [bcrypt_lib.target.mk:113: Release/obj.target/bcrypt_lib/src/bcrypt.o] Error 1
make: Leaving directory '/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/armano/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-42-generic
gyp ERR! command "/home/armano/.nvm/versions/node/v14.7.0/bin/node" "/home/armano/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/armano/_node/moleculer-node-realworld-example-app/node_modules/bcrypt
gyp ERR! node -v v14.7.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.3 (node_modules/sane/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"})
npm WARN moleculer-realworld-example-app@1.0.0 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@1.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Solution:

$ npm uninstall bcrypt --save 
$ npm install bcrypt --save
It will remove bcrypt@1.0.3 and install the bcrypt@5.0.0
...

karipnail

0 / 0 / 0

Регистрация: 21.12.2017

Сообщений: 7

1

19.11.2018, 22:44. Показов 12345. Ответов 4

Метки n, npm (Все метки)


Добрый вечер, у меня появилась проблема. Я не могу загрузить модуль npm, при установки выдаёт ошибки:

PureBasic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
node-pre-gyp ERR! Tried to download(404): https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.8-node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for lzma-native@3.0.8 and node@11.2.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.8-node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for lzma-native@3.0.8 and node@11.2.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibconfigure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibconfigure.js:509:16)
gyp ERR! stack     at C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesgraceful-fspolyfills.js:284:29
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:161:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\pashk\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=E:\bot\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64\lzma_native.node" "--module_name=lzma_native" "--module_path=E:\bot\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64"
gyp ERR! cwd E:botnode_moduleslzma-native
gyp ERR! node -v v11.2.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 'C:Program Filesnodejsnode.exe C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js configure --fallback-to-build --module=E:botnode_moduleslzma-nativebinding-v3.0.8-node-v67-win32-x64lzma_native.node --module_name=lzma_native --module_path=E:botnode_moduleslzma-nativebinding-v3.0.8-node-v67-win32-x64' (1)
gypnode-pre-gyp ERR! stack      at ChildProcess.<anonymous> (E:botnode_moduleslzma-nativenode_modulesnode-pre-gyplibutilcompile.js:83:29)
ERR!node-pre-gyp  configure errorERR!
 stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR!gyp  stack     at maybeClose (internal/child_process.js:978:16)
ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
node-pre-gypgyp  ERR!ERR!  stackstack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
     at PythonFinder.failNoPython (C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibconfigure.js:484:19)
node-pre-gypgyp  ERR!ERR! stack      at PythonFinder.&lt;anonymous> (C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibconfigure.js:509:16)
Systemgyp  Windows_NT 10.0.17134
ERR! node-pre-gypstack ERR!     at C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesgraceful-fspolyfills.js:284:29
 gypcommand  "C:\Program Files\nodejs\node.exe" "E:\bot\node_modules\lzma-native\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
ERR! node-pre-gypstack      at FSReqCallback.oncomplete (fs.js:161:21)
ERR! cwdgyp E:botnode_moduleslzma-native
 node-pre-gypERR!  SystemERR! Windows_NT 10.0.17134
 node -vgyp v11.2.0
 node-pre-gypERR! ERR!  commandnode-pre-gyp -v "C:\Program Files\nodejs\node.exe" "C:\Users\pashk\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=E:\bot\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64\lzma_native.node" "--module_name=lzma_native" "--module_path=E:\bot\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64"
 v0.6.39
gypnode-pre-gyp ERR!  ERR!cwd E:botnode_moduleslzma-native
 gypnot ok
ERR! node -v v11.2.0
Failed to execute 'C:Program Filesnodejsnode.exe C:UserspashkAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js configure --fallback-to-build --module=E:botnode_moduleslzma-nativebinding-v3.0.8-node-v67-win32-x64lzma_native.node --module_name=lzma_native --module_path=E:botnode_moduleslzma-nativebinding-v3.0.8-node-v67-win32-x64' (1)
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'E:botpackage.json'
npm WARN discord.js@11.4.2 requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN bot No description
npm WARN bot No repository field.
npm WARN bot No README data
npm WARN bot No license field.
 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lzma-native@3.0.8 install: `node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lzma-native@3.0.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UserspashkAppDataRoamingnpm-cache_logs2018-11-19T19_29_14_805Z-debug.log

Что мне делать с такой проблемой. Заранее спасибо.
P.s
node версия: 11.2.0
npm версия: 6.4.1

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



272 / 176 / 30

Регистрация: 16.03.2017

Сообщений: 1,626

20.11.2018, 09:37

2

читайте внимательнее:

Цитата
Сообщение от karipnail
Посмотреть сообщение

ERR! stack Error: Can’t find Python executable «python», you can set the PYTHON env variable.

Похоже нужен питон, его надо установить и прописать путь в переменную PYTHON



0



0 / 0 / 3

Регистрация: 30.05.2016

Сообщений: 171

21.11.2018, 11:45

3

Попробуй другую версию node, или попробуй «npm i node-sass -g» и за ним ещё введи «npm build node-sass»



0



0 / 0 / 0

Регистрация: 29.09.2014

Сообщений: 77

21.11.2018, 23:18

4

Проверь версию node и npm, хотя вполне может быть, что модуль кривой



0



Coding is art

Эксперт JS

536 / 420 / 153

Регистрация: 04.09.2013

Сообщений: 1,056

24.11.2018, 08:37

5

В npm есть модули написанные на C/C++ когда их устанавливаешь npm пытается найти уже готовый скомпилированные модуль для вашей версии ноды/ос и т.п., если не находит (https://node-pre-gyp.addaleax…. x64.tar.gz вернул 404), но npm будет пытаться скомпилировать C/C++ модель «на лету». т вот тут то у вас и ошибка. По скольку windows не идёт вместе со всеми необходимыми программами для компиляции (в отличии от линукса), то вам нужно установить так называемый «build essentials» (пак который содержит все необходимые модули для компиляции) в частности вот https://www.npmjs.com/package/windows-build-tools
После того, как установите — перезапустите npm install/npm save и должно работать/компилировать…



0



Since I started doing some testing with Node, I’ve always worked with the latest version of Node. And that’s why I am used to do choco upgrade -y nodejs quite regularly.

This allows me to use the latest JavaScript features without going through Babel or TypeScript. It works because I only do test runs and code and execute everything locally. No doubt that the day I want to put my code into production and deploy it, I will have to review this mode of operation.

But I had never had any problems until now (and yet I work under Windows). So I went from version 12.13.0 of Node to version 13.0.0.0 and then 13.1.0 without worrying, especially since I was taking a little break on the Node side.

And when I wanted to get back to my tests with the «express-validator» module, I was surprised to find that nothing was working anymore…

E:CodeAppTestAA>npm start

> AppTest2@1.0.0 start E:CodeAppTestAA
> node index

internal/modules/cjs/loader.js:803
    throw err;
    ^

Error: Cannot find module 'sqlite3'
Require stack:
- E:CodeAppTestAAindex.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:800:15)
    at Function.Module._load (internal/modules/cjs/loader.js:693:27)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (E:CodeAppTestAAindex.js:4:17)
    at Module._compile (internal/modules/cjs/loader.js:971:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
    at Module.load (internal/modules/cjs/loader.js:822:32)
    at Function.Module._load (internal/modules/cjs/loader.js:730:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1051:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'E:\Code\AppTestAA\index.js' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! AppTest2@1.0.0 start: `node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the AppTest2@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersmichelAppDataRoamingnpm-cache_logs2019-11-20T14_43_27_840Z-debug.log

E:CodeAppTestAA>

At first I thought I had broken everything with my last attempts. So I start again from a «clean» version of the project. I tried to launch this clean code, and here it comes again!

After a quick look at the error messages, I found I might have a version mismatch and tried to reinstall all the packages:

PS E:CodeAppTestAA> rd node_modules /s /q
PS E:CodeAppTestAA> npm install

> sqlite3@4.1.0 install E:CodeAppTestAAnode_modulessqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.0/node-v79-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.1.0 and node@13.0.1 (node-v79 ABI, unknown) (falling back to source compile with node-gyp)
Génération des projets individuellement dans cette solution. Pour activer la génération en parallèle, ajoutez le commutateur "/m".
  unpack_sqlite_dep
TRACKER : error TRK0005: échec de localisation de : "CL.exe". Le fichier spécifié est introuvable. [E:CodeAppTestAAnode_modulessqlite3builddepssqlite3.vcxproj]

gyp ERR! build error
gyp ERR! stack Error: `C:Program Files (x86)MSBuild14.0binMSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gyplibbuild.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=E:\Code\AppTestAA\node_modules\sqlite3\lib\binding\node-v79-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=E:\Code\AppTestAA\node_modules\sqlite3\lib\binding\node-v79-win32-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79"
gyp ERR! cwd E:CodeAppTestAAnode_modulessqlite3
gyp ERR! node -v v13.0.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:Program Filesnodejsnode.exe C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js build --fallback-to-build --module=E:CodeAppTestAAnode_modulessqlite3libbindingnode-v79-win32-x64node_sqlite3.node --module_name=node_sqlite3 --module_path=E:CodeAppTestAAnode_modulessqlite3libbindingnode-v79-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (E:CodeAppTestAAnode_modulesnode-pre-gyplibutilcompile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1028:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\Code\AppTestAA\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd E:CodeAppTestAAnode_modulessqlite3
node-pre-gyp ERR! node -v v13.0.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute 'C:Program Filesnodejsnode.exe C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js build --fallback-to-build --module=E:CodeAppTestAAnode_modulessqlite3libbindingnode-v79-win32-x64node_sqlite3.node --module_name=node_sqlite3 --module_path=E:CodeAppTestAAnode_modulessqlite3libbindingnode-v79-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
npm WARN AppTest2@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.1.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersmichelAppDataRoamingnpm-cache_logs2019-11-20T14_45_17_020Z-debug.log

Even worse! I read the error messages a little better and it seems that the «SQlite3» module is the problem. While digging, it turns out that the binding isn’t up to date and that it doesn’t yet exist for Node 13. And that my configuration can’t build it from sources…

Never mind! All I have to do is uninstall Node 13 and then reinstall version 12.13.0:

E:CodeAppTestAA>choco uninstall -y nodejs
    (and answer Y to uninstall nodejs.install too)
E:CodeAppTestAA>choco install -y nodejs --version=12.13.0

E:CodeAppTestAA>npm install

> sqlite3@4.1.0 install E:CodeAppTestAAnode_modulessqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
[sqlite3] Success: "E:CodeAppTestAAnode_modulessqlite3libbindingnode-v72-win32-x64node_sqlite3.node" is installed via remote
npm WARN AppTest2@1.0.0 No repository field.

added 174 packages from 135 contributors and audited 303 packages in 4.332s
found 0 vulnerabilities

And this time, npm start successfully launched the application.

Conclusion: I should pay a little more attention in the future to what I use and the compatibility problems it can cause. But on the other hand, it’s the first time I’ve encountered such a problem…

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Node must be provided when reporting error if location is not provided
  • Node js обработка ошибок
  • Node js логирование ошибок
  • Node js websocket error
  • Node js validation error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии