We have a Node JS application that is currently built & deployed through a Bamboo pipeline.
We are trying to add the @tensorflow/tfjs-node
package for some machine learning initiatives, but our deploy is failing with the following error:
OUT npm ERR! errno 1
OUT * Building TensorFlow Node.js bindings
OUT node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
OUT internal/modules/cjs/loader.js:934
OUT throw err;
OUT ^
OUT Error: Cannot find module '../'
OUT Require stack:
OUT - /tmp/app/node_modules/.bin/node-pre-gyp
OUT at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15)
OUT at Function.Module._load (internal/modules/cjs/loader.js:774:27)
OUT at Module.require (internal/modules/cjs/loader.js:1003:19)
OUT at require (internal/modules/cjs/helpers.js:107:18)
OUT at Object.<anonymous> (/tmp/app/node_modules/.bin/node-pre-gyp:15:20)
OUT at Module._compile (internal/modules/cjs/loader.js:1114:14)
OUT at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
OUT at Module.load (internal/modules/cjs/loader.js:979:32)
OUT at Function.Module._load (internal/modules/cjs/loader.js:819:12)
OUT at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
OUT code: 'MODULE_NOT_FOUND',
OUT requireStack: [ '/tmp/app/node_modules/.bin/node-pre-gyp' ]
OUT }
OUT npm ERR! code ELIFECYCLE
Depending on the version of @tensorflow/tfjs-node we try to install, the module error may surface as ../lib/main
vs. ../
Everything works locally on a Mac, and the build process succeeds; it's just the deploy that fails.
We are using node v.14.21.3
and npm v.6.14.18
. The iteration the produced the logs above is @tensorflow/tfjs-node v.4.4.0
. The deploy is done through Amazon Linux 2.
We've tried adding the package by itself with an additional NPM build task using the --build-from-source
flag, we've tried adding preinstall
scripts to install the tensorflow package before the rest of the npm install, and we've tried the same approach with the node-pre-gyp package
.
We've also tried an additional build task immediately following the npm install
task: npm rebuild @tensorflow/tfjs-node --build-from-source
I can provide any other details / logs / code necessary.
Thank you in advance - we'd really appreciate any insight!