Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow 部署到IBM云的问题_Tensorflow_Ibm Cloud_Tensorflow.js - Fatal编程技术网

Tensorflow 部署到IBM云的问题

Tensorflow 部署到IBM云的问题,tensorflow,ibm-cloud,tensorflow.js,Tensorflow,Ibm Cloud,Tensorflow.js,我在NodeJS中创建了一个web应用程序,它使用Tensorflow从一个用Python训练的模型中获得预测。我试图通过IBMCloud的CloudFoundrySDK for NodeJS部署它。我遇到的问题是当我试图将我的项目推送到IBMCloud时。从控制台中的日志来看,TensorflowJS节点在安装和运行时 节点gyp重建 它引起了一些问题。由于某种原因,它在运行时遇到了一个错误 /temp/app/node_modules/@tensorflow/tfjs node/deps/t

我在NodeJS中创建了一个web应用程序,它使用Tensorflow从一个用Python训练的模型中获得预测。我试图通过IBMCloud的CloudFoundrySDK for NodeJS部署它。我遇到的问题是当我试图将我的项目推送到IBMCloud时。从控制台中的日志来看,TensorflowJS节点在安装和运行时

节点gyp重建

它引起了一些问题。由于某种原因,它在运行时遇到了一个错误

/temp/app/node_modules/@tensorflow/tfjs node/deps/tensorflow/lib/libtensorflow.so:无法识别文件:无法识别文件格式

从那里它会导致一长串的错误。有人知道我怎么解决这个问题吗

以下是命令行日志

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

这是一个与云环境中安装的NodeJs版本相关的问题。错误显示使用的NodeJs版本是
Node.js(6.14.3)
,而tensorflowJs由于某种原因需要Node V8+

,如果我从工作目录中删除Node\u modules文件夹,然后尝试推送到IBM Cloud,它就可以工作。我猜可能是因为Tensorflow安装时会根据您的操作系统和我的情况安装某些文件

libtensorflow.so


是那些文件中的一个。

哦。我没有想到这一点。我在package.json中指定了它,并认为这样就可以了。我想这是因为我正在使用的构建包的NodeJS版本。让我看看当我关掉它时会发生什么。是的,我确实认为这是问题的根本原因。改变后让我知道结果是什么。我更改了buildpack并确保NodeJS版本大于8。我仍然有相同的问题。@Bootsie123您必须删除节点模块文件夹,并尝试重新安装软件包,否则旧模块仍将被使用,这将导致安装失败