I've got a lot of problem installing TFJS
My situation:
- Python v3.11.9 (from vscode terminal)
- NodeJS v20.14.0 (from vscode terminal)
- Windows 11
- Visual Studio Community installed
What i've done:
- Started a new NodeJS project with npm init y (from vscode terminal on the project folder)
- I've run this: npm install --save-dev electron (always vs code terminal)
- Then I've run this: npm install --save-exact @tensorflow/tfjs-node
With this output:
PS C:\Users\lenovo\Desktop\test-tensor> npm install --save-exact @tensorflow/tfjs-node
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Please use @electron/rebuild moving forward. There is no API change, just a package name change
added 269 packages, and audited 270 packages in 4m
41 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
I've made this simple main.js file:
// main.js
const { app, BrowserWindow } = require('electron')
const tf = require('@tensorflow/tfjs-node')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
But i get this on run of my app:
Uncaught Error Error: The specified module could not be found.
\\?\C:\Users\lenovo\Desktop\test-tensor\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node
at Module._extensions..node (internal/modules/cjs/loader:1454:18)
at Module.load (internal/modules/cjs/loader:1208:32)
at Module._load (internal/modules/cjs/loader:1024:12)
at Module.require (internal/modules/cjs/loader:1233:19)
at require (internal/modules/helpers:179:18)
at <anonymous> (c:\Users\lenovo\Desktop\test-tensor\node_modules\@tensorflow\tfjs-node\dist\index.js:72:16)
at Module._compile (internal/modules/cjs/loader:1358:14)
at Module._extensions..js (internal/modules/cjs/loader:1416:10)
at Module.load (internal/modules/cjs/loader:1208:32)
at Module._load (internal/modules/cjs/loader:1024:12)
at Module.require (internal/modules/cjs/loader:1233:19)
at require (internal/modules/helpers:179:18)
at <anonymous> (c:\Users\lenovo\Desktop\test-tensor\main.js:4:12)
at Module._compile (internal/modules/cjs/loader:1358:14)
at Module._extensions..js (internal/modules/cjs/loader:1416:10)
at Module.load (internal/modules/cjs/loader:1208:32)
at Module._load (internal/modules/cjs/loader:1024:12)
at executeUserEntryPoint (internal/modules/run_main:174:12)
at <anonymous> (internal/main/run_main_module:28:49)
I've already tried multiple times to delete node_modules, reinstall them, rebuild with electron, change python versions, change electron versions....NOTHING WORKED!
At least this is the first time i managed to install TFJS without errors..i think.