0

I am trying to install tensorflow dependency but I am getting an error in the terminal console.

My package.json:

{
  "name": "knn-tf",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@tensorflow/tfjs-node": "^0.1.17",
    "lodash": "^4.17.11",
    "shuffle-seed": "^1.1.6"
  }
}

* Building TensorFlow Node.js bindings
/Users/mateusz/WebstormProjects/ML_JS/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/scripts/install.js:154
      throw new Error('node-gyp rebuild failed with: ' + err);
      ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.



gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mateusz/WebstormProjects/ML_JS/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok 

    at /Users/mateusz/WebstormProjects/ML_JS/MLKits/knn-tf/node_modules/@tensorflow/tfjs-node/scripts/install.js:154:13
    at ChildProcess.exithandler (child_process.js:302:5)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/[email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @tensorflow/[email protected] 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!     /Users/mateusz/.npm/_logs/2020-06-05T21_16_30_200Z-debug.log

This occurs when I am running npm i

I have tried to remove the node_modules and install it from scratches but It has not helped.

Do you have an idea how to fix it?

1 Answer 1

1

some node modules are using node-gyp to compile their code.

in your case, you are using macos so you need to install compilation tools for macos.

you can do that by installing command line tools. this can be done easily by executing

xcode-select --install

or installing xcode from the app store

once the command line tools are installed, re-run npm install (will advise you to delete node_module directory before)

Sign up to request clarification or add additional context in comments.

1 Comment

I had it installed. However, removing the xcode-select and installing it again with the newest version has helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.