使用 TensorFlowJS 项目运行 Yarn Watch 时出错



我正在使用带有纱线和节点 v 8.11.3 的 ubuntu 18 在此处运行示例时 使用以下外壳命令

git clone https://github.com/tensorflow/tfjs-examples
cd tfjs-examples/webcam-transfer-learning
yarn
yarn watch

到达最后一行代码时出现以下错误:

纱线运行 v1.9.4 $ 交叉环境 NODE_ENV=开发宗地指数.html --no-hmr --打开服务器运行在 http://localhost:1234 hourglass_flowing_sand 构建异步到生成器.js...事件.js:183 投掷者;未处理的"错误"事件 ^

错误:监视/home/user/WebstormProjects/tfjs-examples/webcam-transfer-learning/node_modules/core-js/modules/es6.math.fround.js ENOSPC at _errnoException (util.js:992:11( at FSWatcher.start (fs.js:1382:19( at Object.fs.watch (fs.js:1408:11( at 创建FsWatchInstance (/home/user/WebstormProjects/tfjs-examples/webcam-transfer-learning/node_modules/chokidar/lib/nodefs-handler.js:37:15( at setFsWatchListener (/home/user/WebstormProjects/tfjs-examples/webcam-transfer-learning/node_modules/chokidar/lib/nodefs-handler.js:80:15( 在FSWatcher.NodeFsHandler._watchWithNodeFs (/home/user/WebstormProjects/tfjs-examples/webcam-transfer-learning/node_modules/chokidar/lib/nodefs-handler.js:232:14( at FSWatcher.NodeFsHandler._handleFile (/home/uwer/WebstormProjects/tfjs-examples/webcam-transfer-learning/node_modules/chokidar/lib/nodefs-handler.js:259:21( at FSWatcher. (/home/user/WebstormProjects/tfjs-examples/webcam-transfer-learning/node_modules/chokidar/lib/nodefs-handler.js:480:21( at FSReqWrap.oncomplete (fs.js:153:5( error 命令失败并退出 代码 1.信息 访问 https://yarnpkg.com/en/docs/cli/run 有关此命令的文档。

我没有运气找到任何关于它的信息。 我尝试更改tfjs版本,但没有运气 我升级了 Node,并尝试将其降级到早期的稳定版本。 我们尝试在Windows机器上运行它,它起作用了。

我们尝试使用在Windows机器上运行的相同版本:npm 8.10和yarn 5.04,但没有运气

。这里可能有什么问题?

谢谢

在终端中使用下面的两个命令解决了问题,我真的不知道为什么,谁能帮我解释一下?

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo sysctl --system

然后

yarn 
yarn watch

工作精美

谢谢!

另一种选择是使用:

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
yarn watch

为我解决了!

最新更新