tensorflow.js 实现 官网mnist 代码时出现error Command failed with exit code 1且网页无法连接

按官网的方法只需要四步就可以复现mnist。https://js.tensorflow.org/tutorials/mnist.html

$ git clone https://github.com/tensorflow/tfjs-examples
$ cd tfjs-examples/mnist
$ yarn
$ yarn watch

但是我运行到yarn watch 的时候,报错,error Command failed with exit code 1.

完整错误为:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: watch /home/zdzn/tfjs-examples/mnist/node_modules/lodash/fp/transform.js ENOSPC
    at _errnoException (util.js:1024:11)
    at FSWatcher.start (fs.js:1374:19)
    at Object.fs.watch (fs.js:1400:11)
    at createFsWatchInstance (/home/zdzn/tfjs-examples/mnist/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/zdzn/tfjs-examples/mnist/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/zdzn/tfjs-examples/mnist/node_modules/chokidar/lib/nodefs-handler.js:232:14)
    at FSWatcher.NodeFsHandler._handleFile (/home/zdzn/tfjs-examples/mnist/node_modules/chokidar/lib/nodefs-handler.js:259:21)
    at FSWatcher.<anonymous> (/home/zdzn/tfjs-examples/mnist/node_modules/chokidar/lib/nodefs-handler.js:480:21)
    at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

然后参考这里:https://github.com/facebook/jest/issues/3254

找到解决方法:

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

然后就可以yarn watch 啦!

结果显示:

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页