tfjs-node "Illegal instruction: 4" error on macOS Monterey (M1)
See original GitHub issueSystem information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS 12.1 (Monterey), 2020 MacBook Air M1
- TensorFlow.js installed from (npm or script link): npm
- TensorFlow.js version: “@tensorflow/tfjs”: “^3.16.0”, “@tensorflow/tfjs-node”: “^3.16.0”
Describe the problem In an empty project, installing and requiring @tensorflow/tfjs-node results in an “Illegal instruction: 4” error thrown.
Provide the exact sequence of commands / steps that you executed before running into the problem
- Create an empty project (
npm init
) yarn add @tensorflow/tfjs-node
in project root- create an
index.js
file and addconst tf = require('@tensorflow/tfjs-node')
at the top of the file node index.js
in project root- observe error “Illegal instruction: 4” thrown
As reported in the closed https://github.com/tensorflow/tfjs/issues/4514 ticket, tfjs-node
doesn’t appear to work with macOS Monterey. Is there any way to make it work?
Would appreciate any tips, cheers!
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:14
Top Results From Across the Web
What is the "Illegal Instruction: 4" error and why does "
I get Illegal Instruction: 4 errors with binaries compiled with GCC 4.7.2 under Mac OS X 10.8.2 ("Mountain Lion"), when those binaries are...
Read more >Fixing "Illegal instruction 4 error in macOS terminal when ...
Hi, I am currently trying to install deep labcut on my macbook (has an M1 chip and is running on Big sur version...
Read more >tensorflow-metal | Apple Developer Forums
I was trying to train a tf model with on my M1 macbook pro then got a InvalidArgumentError, as follows: InvalidArgumentError: Cannot assign...
Read more >@tensorflow/tfjs-node - npm
This repository provides native TensorFlow execution in backend JavaScript applications under the Node.js runtime, accelerated by the ...
Read more >How to - zsh: illegal hardware instruction (TensorFlow m1 Mac)
in this video i show you exactly How to fix - zsh: illegal hardware instruction ( M1 Mac Tensorflow Error ) - this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @MikeOBarometer @Caundy I have tried the setup Mike mentioned, it is also working for me. There are couple caveats you need to pay attention to:
This way, your node environment arch matches with tfjs-node binding and TF download. And x86-64 arch that enabled by rosetta would not work with tensorflow (the illegal instruction 4 error), even though all archs match. Please let me know if this would work for you.
Strange! Let me know if I can provide any other system info if it helps. Here’s my versions + arch