I created a web app in NodeJS which uses Tensorflow to get a prediction from a model trained in Python. What I'm trying to do is deploy that through IBM Cloud's Cloud Foundry SDK for NodeJS. The problem I'm running into is when I'm trying to push my project to IBM Cloud. From looking at the logs in the console it seems that TensorflowJS Node when it's installing and runs
node-gyp rebuild
it causes some issues. For some reason it runs into an error when that's running which is
/temp/app/node_modules/#tensorflow/tfjs-node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File format not recognized
and from there it causes a long chain of errors. Anyone know how I can fix this?
Here is are the command line logs.
Downloaded build artifacts cache (484.1K)
Staging...
-----> IBM SDK for Node.js Buildpack v3.21-20180628-1258
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing IBM SDK for Node.js (6.14.3) from cache
Using default npm version: 3.10.10
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules (exists - skipping)
- bower_components (not cached - skipping)
-----> Checking and configuring service extensions before installing
dependencies
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> protobufjs#6.8.8 postinstall /tmp/app/node_modules/protobufjs
> node scripts/postinstall
> #tensorflow/tfjs-node#0.1.9 install
/tmp/app/node_modules/#tensorflow/tfjs-node
> node-gyp rebuild
make: Entering directory `/tmp/app/node_modules/#tensorflow/tfjs-
node/build'
ACTION binding_gyp_tfjs_binding_target_download_libtensorflow
Release/libtensorflow.so
CXX(target) Release/obj.target/tfjs_binding/binding/tfe_utils.o
CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_backend.o
CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_binding.o
SOLINK_MODULE(target) Release/obj.target/tfjs_binding.node
/tmp/app/node_modules/#tensorflow/tfjs-
node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File
format
not recognized
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/tfjs_binding.node] Error 1
make: Leaving directory `/tmp/app/node_modules/#tensorflow/tfjs-
node/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit
(/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-
gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:219:12)
gyp ERR! System Linux 4.4.0-109-generic
gyp ERR! command "/tmp/app/vendor/node/bin/node"
"/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-
gyp/bin/node- gyp.js" "rebuild"
gyp ERR! cwd /tmp/app/node_modules/#tensorflow/tfjs-node
gyp ERR! node -v v6.14.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Failed at the #tensorflow/tfjs-node#0.1.9 install script
'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm
installed.
npm ERR! node-gyp rebuild
npm ERR! Linux 4.4.0-109-generic
npm ERR! argv "/tmp/app/vendor/node/bin/node"
"/tmp/app/vendor/node/bin/npm" "rebuild" "--
nodedir=/tmp/app/vendor/node"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! #tensorflow/tfjs-node#0.1.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! If you do, this is most likely a problem with the
#tensorflow/tfjs-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! You can get information on how to open an issue for this
project with:
npm ERR! npm bugs #tensorflow/tfjs-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls #tensorflow/tfjs-node
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support
request:
npm ERR! /tmp/app/npm-debug.log
-----> Build failed
Some possible problems:
- node_modules checked into source control
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
- Node version not specified in package.json
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
Failed to compile droplet: Failed to compile droplet: exit status 1
Exit status 223
Staging failed: STG: Exited with status 223
Stopping instance 4e1dd2ee-71b4-4f84-95e8-c5f6c7bd24e0
Destroying container
Error staging application: App staging failed in the buildpack compile
phase
FAILED
It is a problem related to the version of NodeJs installed on your cloud environment. The errors shows that the version of NodeJs being used is Node.js (6.14.3) whereas tensorflowJs requires Node V8+
For some reason if I remove the node_modules folder from the working directory and then try to push to IBM Cloud it works. My guess is probably because when Tensorflow installs it installs certain files depending on your operating system and in my case
libtensorflow.so
was one of those files.
Related
i try to start a new ionic project and get the following Error
gyp ERR! node -v v14.20.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN AppName#0.0.1 No repository field.
npm WARN AppName#0.0.1 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I already downgraded to Node 14 as mentioned by some others.
Is there anything else i could try?
Thanks!
SOLVED:
Node Version downgrade to 12 using nvm
I have the same problem you and also i downgrade node 12
and i will face with this error:
Downloading and installing node v12.22.12...
Downloading https://nodejs.org/dist/v12.22.12/node-v12.22.12-darwin-arm64.tar.xz...
curl: (22) The requested URL returned error: 404
Binary download from https://nodejs.org/dist/v12.22.12/node-v12.22.12-darwin-arm64.tar.xz failed, trying source.
grep: /Users/clooner/.nvm/.cache/bin/node-v12.22.12-darwin-arm64/node-v12.22.12-darwin-arm64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!
Local cache found: ${NVM_DIR}/.cache/src/node-v12.22.12/node-v12.22.12.tar.xz
Checksums match! Using existing downloaded archive ${NVM_DIR}/.cache/src/node-v12.22.12/node-v12.22.12.tar.xz
$>./configure --prefix=/Users/clooner/.nvm/versions/node/v12.22.12 <
./configure: line 3: exec: python: not found
nvm: install v12.22.12 failed!
I tried to install saltcorn using this wiki page. https://wiki.saltcorn.com/view/ShowPage/install-on-windows-10
It is failing due to vips error
npm 8.1.0
node 16.13.0
C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! nothing.c
npm ERR! win_delay_load_hook.cc
npm ERR! nothing.vcxproj -> C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp\build\Release\\nothing.lib
npm ERR! VError.cpp
npm ERR! C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp\src\libvips\cplusplus\VError.cpp(33,10): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file or directory [C:\Users\varsha\AppData\Roaming\npm\node_modules\#saltcorn\cli\node_modules\sharp\build\libvips-cpp.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.2.0
npm ERR! gyp info using node#16.13.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.0 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32002.261) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
Your node is too recent, try downgrading to node 15. See:
https://sharp.pixelplumbing.com/install
Background: sharp ships binaries for most platforms, but not yet node16 (as of the time of writing). If it does not have precompiled binaries available, sharp will try to build them for you on your machine using node-gyp. Sadly, especially on windows, this is extremely fragile and can break in 1000s of bizarre ways.
You can spend many hours trying to fix it, or (much more sensibly) you can switch to a supported version of node.
while trying to install parcel through npm in VScode, getting the below error.
npm ERR! code 1
npm ERR! path C:\Users\user-id\ws-js-001\node_modules\#parcel\watcher
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#16.2.0 | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python checking Python explicitly set from command line or npm configuration
npm ERR! gyp ERR! find Python - "--python=" or "npm config get python" is "python3.10"
npm ERR! gyp ERR! find Python - "python3.10" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking Python explicitly set from environment variable PYTHON
npm ERR! gyp ERR! find Python - process.env.PYTHON is "C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp ERR! find Python - "C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe" is not in PATH
or produced an error
The config value in config file is
C:\Users\user-id\ws-js-001> npm config get python
python3.10
Also the environment variable python is set to
C:\Windows\system32>set PYTHON
PYTHON=C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe
Could you please help me with the changes that are required to fix this issue.
#parcel/watcher is a native C++ package that parcel uses to monitor your project for changes and re-build when it sees them. To create the bindings between native C++ and node under the hood, it uses node-gyp-build. According to node-gyp documentation:
node-gyp requires that you have installed a compatible version of Python, one of: v3.6, v3.7, v3.8, or v3.9.
So I'd recommend upgrading your version of python to one of the supported versions.
(Side note - it looks like #parcel/watcher includes a pre-built binaries for a number of platforms, including windows-x64, so that you don't need to build anything with node-gyp if you are consuming the package on those systems. My guess is that you're using 32-bit windows, because that doesn't seem to be included - is that right?)
how to fix an error of creating Vue 3 project + Jest?
I used npm i -g #vue/cli
and
vue create .
Logs:
/*
Microsoft Windows [Version 10.0.17763.1217]
(c) 2018 Microsoft Corporation. All rights reserved.
D:\Projects\FrontEnd\fcrp>vue create .
Vue CLI v4.5.13
? Generate project in current directory? Yes
Vue CLI v4.5.13
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors, Linter, Unit, E2E
? Choose a version of Vue.js that you want to start the project with 3.x
? Use history mode for router? (Requires proper server setup for index fallback in production) No
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS (with dart-sass)
? Pick a linter / formatter config: Prettier
? Pick additional lint features: Lint on save
? Pick a unit testing solution: Jest
? Pick an E2E testing solution: WebdriverIO
? Pick browsers to run end-to-end test on Chrome, Firefox
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? No
Vue CLI v4.5.13
✨ Creating project in D:\Projects\FrontEnd\fcrp.
⚙️ Installing CLI plugins. This might take a while...
npm ERR! code 1
npm ERR! path D:\Projects\FrontEnd\fcrp\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! fibers.cc
npm ERR! C:\Users\Vector\AppData\Local\node-gyp\Cache\16.2.0\include\node\node.h(63,10): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [D:\Projects\FrontEnd\fcrp\node_modules\fibers\build\fibers.vcxproj]
npm ERR! (node:1448) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.17763
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Projects\FrontEnd\fcrp\node_modules\fibers
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Vector\AppData\Local\npm-cache\_logs\2021-06-01T00_11_29_219Z-debug.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps
D:\Projects\FrontEnd\fcrp>
*/
Node is installed and additional files are installed, but the problem is not solved, What is going wrong
npm install --global --production windows-build-tools
npm install --global node-gyp
Didn't help to solve the problem
Mocha + Chai works fine without an errors but Jest get errors
WebdriverIO (WebDriver/DevTools based) also raises an error but Cypress (Chrome only) works fine
I am trying to install Hyperledger Caliper CLI from npm.
However, can't bind the sut, fabric SDK with caliper. It shows the following -
2020.01.12-19:29:43.747 info [caliper] [bind] Calling npm with: install grpc#1.14.2 fabric-ca-client#1.4.4 fabric-client#1.4.4 fabric-protos#2.0.0-snapshot.1 fabric-network#1.4.4
npm WARN deprecated hoek#4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
> pkcs11js#1.0.19 install /home/necos/caliper/caliper-benchmarks/node_modules/pkcs11js
> node-gyp rebuild
gyp WARN EACCES current user ("necos") does not have permission to access the dev dir "/root/.cache/node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/necos/caliper/caliper-benchmarks/node_modules/pkcs11js/.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 '/home/necos/caliper/caliper-benchmarks/node_modules/pkcs11js/.node-gyp'
gyp ERR! System Linux 4.15.0-74-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/necos/caliper/caliper-benchmarks/node_modules/pkcs11js
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN notsup Unsupported engine for fabric-protos#2.0.0-snapshot.1: wanted: {"node":"^8.9.0","npm":"^5.5.1"} (current: {"node":"8.10.0","npm":"6.13.6"})
npm WARN notsup Not compatible with your version of node/npm: fabric-protos#2.0.0-snapshot.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pkcs11js#1.0.19 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.19 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! /root/.npm/_logs/2020-01-12T22_30_01_834Z-debug.log
2020.01.12-19:30:01.898 error [caliper] [bind] Failed to execute "npm" with return code 1.
Error: Failed to execute "npm" with return code 1.
at ChildProcess.proc.on (/home/necos/caliper/caliper-benchmarks/node_modules/#hyperledger/caliper-cli/lib/utils/cmdutils.js:56:35)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
Command failed
I tried node-gyp rebuild, but seems of no use.
Anybody can clarify what's happening here?
Installation environment:
Ubuntu bionic on the server,
NodeJS v8.10
node-gyp v6.1.0
node-pre-gyp v0.14.0
Docker v19.03.1
Docker-compose v0.19.20
This is the root of the problem:
gyp WARN EACCES current user ("necos") does not have permission to access the dev dir "/root/.cache/node-gyp/8.10.0
The Caliper install guide contains workarounds for this problem:
https://hyperledger.github.io/caliper/vLatest/installing-caliper/#installing-from-npm
The above is inspired by the official NPM guide for the same problem:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally