tensorflow.js - 安装 tensorflow/tfjs-node 时出现 sysmlink 错误
问题描述
我正在尝试安装@tensorflow/tfjs-node@3.2.1(最新)。我已经关注了我看到的关于此类问题的许多其他问题,但尚未找到针对此特定问题的答案。
我已经使用所需的构建工具安装了 Visual Studio。
节点 14.15.5
尝试使用和不使用标志。
这是安装命令的输出:
$ npm install @tensorflow/tfjs-node --build-from-source
npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
> @tensorflow/tfjs-node@3.2.0 install C:\Users\dark_\Desktop\projects\tfjs2\node_modules\@tensorflow\tfjs-node
> node scripts/install.js
CPU-windows-3.2.0.zip
* Downloading libtensorflow
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed: null
npm WARN tfjs2@1.0.0 No description
npm WARN tfjs2@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@3.2.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@3.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dark_\AppData\Roaming\npm-cache\_logs\2021-02-27T18_14_41_492Z-debug.log
解决方案
在花了一天时间尝试通常的嫌疑人(node-gyp重新安装为全局,Windows构建工具(重新)安装为全局,参数设置等)之后,我调试了安装脚本并发现了一个错误:在符号链接之后,作者没有检查“error”变量,直接进入process.exit(1)
在我撕掉头发后,我发现解决方案正在路上:
https://github.com/tensorflow/tfjs/commit/2e745c8b6efe5ffc396a86cfc50347e629091248
它已经提交到主分支(2021.02.26),所以我们可能会在 v3.3.0 或 v3.2.x 中看到它
现在的问题是,如果您只是做一个简单npm install @tensorflow\tfjs-node
的 . 安装程序,安装程序会将其视为错误,并删除node_modules
. 您可以通过以下方式阻止整个事情:
- 执行中
npm install @tensorflow/tfjs-node --ignore-scripts
- 然后在安装脚本中手动更正错误(检查上面链接中的提交)和
- 正在运行
npm rebuild @tensorflow/tfjs-node --build-from-source
。
我需要重新启动 VSCode,因为它很难获取参考。但如果你不想乱七八糟,暂时回到 v2.x 分支。
推荐阅读
- node.js - 使用 node.js 的机器人中的超链接
- mysql - 如何在 Laravel/Lumen 查询生成器中使用 mySQL convert_tz 函数
- python - Python线程和多处理
- java - 当没有使用firebase的互联网连接时如何获取对手用户的在线/离线状态
- laravel - Mail::later() 在 laravel 中立即发送
- java - 无法在 glassfish 上运行或部署我的项目
- cookies - 边缘会话.cookie_lifetime
- java - 如何解决与 rest api POST 请求相关的异常?
- python - 运行存储在列表中的单个 python 导入语句
- angular - 如何使用 MatIcon 获取 assignment_returned Material Font 图标的大纲版本?