Error in installing node-red-contrib-tf-model

Hello
Whenever I try to install
node-red-contrib-tf-model
I get this error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: node-red-project@0.0.1
npm ERR! Found: @tensorflow/tfjs-node@3.9.0
npm ERR! node_modules/@tensorflow/tfjs-node
npm ERR!   @tensorflow/tfjs-node@"^3.9.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @tensorflow/tfjs-node@"^1.4.0" from node-red-contrib-tf-model@0.1.11
npm ERR! node_modules/node-red-contrib-tf-model
npm ERR!   node-red-contrib-tf-model@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

I tried to delete all tensorflow folders from node-red but it did not work.

Did you install the prerequisites as defined on the node's page?

I did.. Inside node-red folder

What platform are you running node-red on?
What version of NR and node.js (you can get this from the start up log)

(Sorry I took so long to get back to - family matters)

No worries..
I run it on Mac and
[info] Node-RED version: v2.0.5
[info] Node.js version: v16.11.1

On my mac - running node.js 14.16.0 - I opened a terminal window and ran

cd .node-red
npm install @tensorflow/tfjs-node
npm install node-red-contrib-tf-model

and it seemed to import fine. So it may be a node.js version issue.
What version of macOS are you running and what type of Mac are you using?

Note - I do get this when NR starts up:

17 Oct 06:53:50 - [warn] ------------------------------------------------------
17 Oct 06:53:50 - [warn] [node-red-contrib-tf-model/tf-model] TypeError: Cannot read property 'whereImpl' of undefined
17 Oct 06:53:50 - [warn] ------------------------------------------------------

I have macOS Big Sur 11.6 on Macbook air 2017.
I updated the version on Node.js, but still getting the same error when I run

npm install node-red-contrib-tf-model

I tried to run

npm audit fix

and got this

fix available via npm audit fix --force
Will install node-red-contrib-tfjs-coco-ssd@0.5.0, which is a breaking change
node_modules/node-fetch
@tensorflow/tfjs-core 1.1.0 - 2.4.0
Depends on vulnerable versions of node-fetch
node_modules/@tensorflow/tfjs-core
node_modules/node-red-contrib-tfjs-coco-ssd/node_modules/@tensorflow/tfjs-core
@tensorflow-models/coco-ssd 1.1.0 - 2.0.3
Depends on vulnerable versions of @tensorflow/tfjs-core
node_modules/@tensorflow-models/coco-ssd
node-red-contrib-tfjs-coco-ssd *
Depends on vulnerable versions of @tensorflow-models/coco-ssd
Depends on vulnerable versions of @tensorflow/tfjs-node
node_modules/node-red-contrib-tfjs-coco-ssd
@tensorflow/tfjs 0.14.0 - 2.4.0
Depends on vulnerable versions of @tensorflow/tfjs-core
Depends on vulnerable versions of @tensorflow/tfjs-data
node_modules/node-red-contrib-tfjs-coco-ssd/node_modules/@tensorflow/tfjs
@tensorflow/tfjs-node 1.1.0 - 2.4.0
Depends on vulnerable versions of @tensorflow/tfjs
node_modules/node-red-contrib-tfjs-coco-ssd/node_modules/@tensorflow/tfjs-node
@tensorflow/tfjs-converter 1.1.0 - 2.4.0
Depends on vulnerable versions of @tensorflow/tfjs-core
node_modules/@tensorflow/tfjs-converter
node_modules/node-red-contrib-tfjs-coco-ssd/node_modules/@tensorflow/tfjs-converter
@tensorflow/tfjs-data <=2.4.0
Depends on vulnerable versions of @tensorflow/tfjs-core
Depends on vulnerable versions of node-fetch
node_modules/node-red-contrib-tfjs-coco-ssd/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-data
@tensorflow/tfjs-layers 1.1.0 - 2.4.0
Depends on vulnerable versions of @tensorflow/tfjs-core
node_modules/node-red-contrib-tfjs-coco-ssd/node_modules/@tensorflow/tfjs-layers

Don't do that. It may break your system.

Did you update or downgrade? So what version of node.js are you now running? (just enter node -v in a terminal session)

I'm also running macOS v11.6 on a Mac mini (M1) running node v14.16.0
Here is my install log:

Paul@Mac-mini ~ % cd .node-red
Paul@Mac-mini .node-red % npm install @tensorflow/tfjs-node

> @tensorflow/tfjs-node@3.9.0 install /Users/Paul/.node-red/node_modules/@tensorflow/tfjs-node
> node scripts/install.js

CPU-darwin-3.9.0.tar.gz
* Downloading libtensorflow
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.5.0.tar.gz
[==============================] 14410884/bps 100% 0.0s
* Building TensorFlow Node.js bindings
npm WARN @tensorflow-models/mobilenet@2.1.0 requires a peer of @tensorflow/tfjs-converter@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow-models/mobilenet@2.1.0 requires a peer of @tensorflow/tfjs-core@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow-models/posenet@2.2.2 requires a peer of @tensorflow/tfjs-converter@^3.0.0-rc.1 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow-models/posenet@2.2.2 requires a peer of @tensorflow/tfjs-core@^3.0.0-rc.1 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-contrib-ui-led@0.4.9 requires a peer of node-red-dashboard@^2.23.3 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-contrib-ui-mp4frag@0.1.0-beta.3 requires a peer of node-red-dashboard@^2.26.1 but none is installed. You must install peer dependencies yourself.
npm WARN xterm-addon-fit@0.3.0 requires a peer of xterm@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-layers@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-backend-webgl@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-data@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-backend-cpu@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ @tensorflow/tfjs-node@3.9.0
updated 1 package and audited 1246 packages in 19.13s

64 packages are looking for funding
  run `npm fund` for details

found 72 vulnerabilities (5 low, 24 moderate, 40 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
Paul@Mac-mini .node-red % npm install node-red-contrib-tf-model        
npm WARN @tensorflow-models/mobilenet@2.1.0 requires a peer of @tensorflow/tfjs-converter@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow-models/mobilenet@2.1.0 requires a peer of @tensorflow/tfjs-core@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow-models/posenet@2.2.2 requires a peer of @tensorflow/tfjs-converter@^3.0.0-rc.1 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow-models/posenet@2.2.2 requires a peer of @tensorflow/tfjs-core@^3.0.0-rc.1 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-backend-cpu@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-backend-webgl@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-data@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-layers@3.9.0 requires a peer of @tensorflow/tfjs-core@3.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-contrib-ui-led@0.4.9 requires a peer of node-red-dashboard@^2.23.3 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-contrib-ui-mp4frag@0.1.0-beta.3 requires a peer of node-red-dashboard@^2.26.1 but none is installed. You must install peer dependencies yourself.
npm WARN xterm-addon-fit@0.3.0 requires a peer of xterm@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-contrib-tf-model@0.1.11 requires a peer of @tensorflow/tfjs-node@^1.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-contrib-tf-model@0.1.11
added 1 package from 1 contributor and audited 1247 packages in 4.193s

68 packages are looking for funding
  run `npm fund` for details

found 72 vulnerabilities (5 low, 24 moderate, 40 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
Paul@Mac-mini .node-red % 

I have node.js version v16.11.1

should I try this command
npm install --legacy-peer-deps
??

You can try anything you like, but it won't change the error you showed earlier, if indeed the error you are now getting is exactly the same.

To check that node_modules is not messed up then rename the .node-red/node_modules folder to something else, and in the .node-red folder run
npm install
(which may take some time) and, assuming that runs without error, then try installing the node again. If it fails then please post the full log including the command you entered.

Can you downgrade node.js to v14.16.0?

I tried it and it worked. I will be using a new machine soon. So the temporary solution fine for me now.
Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.