我有一个非常有问题的问题。当我尝试运行这个简单的 tfjs-node 图像识别示例(https://github.com/tejas77/node-image-classification)时,它不起作用。我问了一个人:macOS BigSur, node v14.18.1
它奏效了。
我的设置是:MacOS Catalina, node -v v16.13.1
.
我的依赖是:
"dependencies": {
"@tensorflow-models/mobilenet": "^2.0.4",
"@tensorflow/tfjs": "^1.2.10",
"@tensorflow/tfjs-node": "^1.2.10"
}
当我运行这个示例时,它会抛出:
/Users/cyrus/Documents/PERSONAL PROJECTS/Playground/test/node-image-classification/node_modules/@tensorflow/tfjs-node/dist/index.js:49
throw new Error("The Node.js native addon module (tfjs_binding.node) can not "
^
Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: /Users/cyrus/Documents/PERSONAL PROJECTS/Playground/test/node-image-classification/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node.
Please run command 'npm rebuild @tensorflow/tfjs-node build-addon-from-source' to rebuild the native addon module.
If you have problem with building the addon module, please check https://github.com/tensorflow/tfjs/blob/master/tfjs-node/WINDOWS_TROUBLESHOOTING.md or file an issue.
at Object.<anonymous> (/Users/cyrus/Documents/PERSONAL PROJECTS/Playground/test/node-image-classification/node_modules/@tensorflow/tfjs-node/dist/index.js:49:11)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/cyrus/Documents/PERSONAL PROJECTS/Playground/test/node-image-classification/classify.js:8:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
当我尝试从源头重建时,它说:rebuilt dependencies successfully
.
然后,当我再次运行节点文件时,它会引发相同的错误。