jeudi 13 mai 2021

Cannot import multiple libraries of tfjs models at the same time in nodejs

In tfjs models, there are many models like mobilenet, posenet, knn classifier.... When I import a model like mobilenet: npm i @tensorflow-models/mobilenet . It was successful. But when I import any other model like knn-classifier : npm i @tensorflow-models/knn-classifier. It returns a message

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency treenpm ERR!
npm ERR! Found: @tensorflow/tfjs-core@3.6.0        
npm ERR! node_modules/@tensorflow/tfjs-core        
npm ERR!   peer @tensorflow/tfjs-core@"^3.1.0" from @tensorflow-models/mobilenet@2.1.0
npm ERR!   node_modules/@tensorflow-models/mobilenet
npm ERR!     @tensorflow-models/mobilenet@"^2.1.0" 
from the root project
npm ERR!   @tensorflow/tfjs-core@"3.6.0" from @tensorflow/tfjs@3.6.0
npm ERR!   node_modules/@tensorflow/tfjs
npm ERR!     @tensorflow/tfjs@"^3.6.0" from the root project
npm ERR!   5 more (@tensorflow/tfjs-backend-cpu, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @tensorflow-models/knn-classifier@"*" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @tensorflow/tfjs-core@1.7.4
npm ERR! node_modules/@tensorflow/tfjs-core        
npm ERR!   peer @tensorflow/tfjs-core@"^1.2.1" from @tensorflow-models/knn-classifier@1.2.2
npm ERR!   node_modules/@tensorflow-models/knn-classifier
npm ERR!     @tensorflow-models/knn-classifier@"*" 
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!
npm ERR! See C:\Users\PC\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PC\AppData\Local\npm-cache\_logs\2021-05-14T02_08_54_031Z-debug.log

How to fix it

Aucun commentaire:

Enregistrer un commentaire