Reputation: 538
I'm trying to use TensorFlow.js for array operations in a JavaScript project. I'm importing it in my Vue component with import * as tf from '@tensorflow/tfjs';
It appears yarn install tensorflow
requires Python 2.7, so I instead used yarn add tensorflow/tfjs
to install the subset of Tensorflow.js I needed. This appeared to work, but when I did yarn run serve
I got this message:
ERROR Failed to compile with 1 errors
This dependency was not found:
* @tensorflow/tfjs in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DetectorPlot.vue?vue&type=script&lang=js&
To install it, you can run: npm install --save @tensorflow/tfjs
In yarn.lock
after yarn add tensorflow/tfjs
I see:
"@tensorflow/tfjs@github:tensorflow/tfjs":
version "1.1.0"
resolved "https://codeload.github.com/tensorflow/tfjs/tar.gz/74b4edef368aa39decc6073af735f81d112bafd8"
dependencies:
"@tensorflow/tfjs-converter" "1.1.0"
"@tensorflow/tfjs-core" "1.1.0"
"@tensorflow/tfjs-data" "1.1.0"
"@tensorflow/tfjs-layers" "1.1.0"
Upvotes: 1
Views: 617
Reputation: 538
Thanks to a friend, I have a solution:
yarn remove @tensorflow/tfjs
and
yarn add @tensorflow/tfjs
I guess it got in a weird state when the first attempt to install tensorflow failed. (It's depressing how often the answer is "turn it off and on again"...)
Upvotes: 1