gpt4 book ai didi

javascript - "Dependency was not found"for tfjs in Vue/Webpack project with yarn

转载 作者:行者123 更新时间:2023-11-30 19:36:35 24 4
gpt4 key购买 nike

我正在尝试使用 TensorFlow.js 在 JavaScript 项目中进行数组操作。我正在使用 import * as tf from '@tensorflow/tfjs';

将它导入到我的 Vue 组件中

yarn install tensorflow 似乎需要 Python 2.7,因此我改为使用 yarn add tensorflow/tfjs 来安装我需要的 Tensorflow.js 子集。这似乎有效,但是当我执行 yarn run serve 时,我收到了这条消息:

 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

yarn.lock 之后 yarn add tensorflow/tfjs 我看到了:


"@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"

最佳答案

感谢 friend ,我有一个解决方案:

yarn 移除@tensorflow/tfjs

yarn 添加@tensorflow/tfjs

我猜它在第一次尝试安装 tensorflow 失败时进入了一个奇怪的状态。 (令人沮丧的是,答案经常是“将其关闭并重新打开”...)

关于javascript - "Dependency was not found"for tfjs in Vue/Webpack project with yarn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55893511/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com