tfjs: Cannot install tfjs-node on production server
Hello -
I’m working on a project using danfojs-node@1.1.2 and @tensorflow/tfjs-node@3.20.0. I’m able to run this locally, but it fails when trying to deploy to a dev environment using Cloud Foundry.
I initially was using 3.21.0, but the http key for the pre-built binary was resulting in a 404 error.
Relevant portion of the logs:
OUT > node scripts/install.js
OUT * Building TensorFlow Node.js bindings
OUT CPU-linux-3.20.0.tar.gz
OUT node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
OUT internal/modules/cjs/loader.js:905
OUT throw err;
OUT ^
OUT Error: Cannot find module '../lib/main'
OUT Require stack:
OUT - /tmp/app/node_modules/.bin/node-pre-gyp
OUT at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
OUT at Function.Module._load (internal/modules/cjs/loader.js:746:27)
OUT at Module.require (internal/modules/cjs/loader.js:974:19)
OUT at require (internal/modules/cjs/helpers.js:101:18)
OUT at Object.<anonymous> (/tmp/app/node_modules/.bin/node-pre-gyp:4:1)
OUT at Module._compile (internal/modules/cjs/loader.js:1085:14)
OUT at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
OUT at Module.load (internal/modules/cjs/loader.js:950:32)
OUT at Function.Module._load (internal/modules/cjs/loader.js:790: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
OUT npm ERR! errno 1
OUT npm ERR! @tensorflow/tfjs-node@3.20.0 install: `node scripts/install.js`
OUT npm ERR! Exit status 1
OUT npm ERR!
OUT npm ERR! Failed at the @tensorflow/tfjs-node@3.20.0 install script.
OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
OUT npm ERR! A complete log of this run can be found in:
OUT npm ERR! /home/vcap/.npm/_logs/2023-01-11T21_21_42_189Z-debug.log
OUT [31;1m**ERROR**[0m Unable to build dependencies: exit status 1
OUT [31;1m**WARNING**[0m A module may be missing from 'dependencies' in package.json
ERR Failed to compile droplet: Failed to run all supply scripts: exit status 14
OUT Exit status 223
OUT Cell 9dfd1aab-715e-4748-8944-33ac34cc84ad stopping instance c243f510-0919-41c0-82e3-90b9e35ee860
OUT Cell 9dfd1aab-715e-4748-8944-33ac34cc84ad destroying container for instance c243f510-0919-41c0-82e3-90b9e35ee860
And these are the relevant dependencies in package.json:
"dependencies": {
"@lmig/health": "^5.0.0",
"@tensorflow/tfjs-node": "3.20.0",
"async": "^3.2.4",
"bl": "^5.0.0",
"body-parser": "^1.20.0",
"browserify-fs": "^1.0.0",
"cors": "^2.8.5",
"danfojs-node": "^1.1.2",
"dotenv": "^11.0.0",
"express": "^4.17.1",
"express-routemagic": "^2.0.6",
"fast-csv": "^4.3.6",
"got": "^12.1.0",
"https": "^1.0.0",
"json-2-csv": "^3.14.4",
"morgan": "^1.10.0",
"node-gyp": "^9.3.1"
We’ve tried various combinations of node & tfjs-node versions, but can’t seem to get past the package installs.
I can provide additional logging if needed, or any other info you may need.
TIA
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (6 by maintainers)
This is interesting. It looks like the
@mapbox/node-pre-gyp
module is missing. Can you check thatnode_modules/@mapbox/node-pre-gyp
exists when you run on bamboo?This is actually a good sign. It indicates that tfjs-node was able to load its tensorflow native binary.