Russ Petersen
Russ Petersen

Reputation: 765

Why doesn't npm apiconnect install correctly on Win 10?

I've tried installing apiconnect several times without any success

npm install -g apiconnect

C:\Program Files\nodejs\node_modules\apiconnect\node_modules\heapdump>if not defined npm_config_node_gyp (node "C:\Users\Russ\AppData\Roaming\nvm\v9.5.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Russ\AppData\Roaming\nvm\v9.5.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Russ\AppData\Local\Programs\Python\Python36\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\Russ\AppData\Roaming\nvm\v9.5.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\Russ\AppData\Roaming\nvm\v9.5.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\Russ\AppData\Roaming\nvm\v9.5.0\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:166:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Russ\\AppData\\Roaming\\nvm\\v9.5.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Program Files\nodejs\node_modules\apiconnect\node_modules\heapdump
gyp ERR! node -v v9.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Both loopback-cli and strongloop have installed correctly without any errors.

At first I didn't have Python installed, but now it is and I have added the PYTHON environment variable (added it to the System variables) as the error suggests - "you can set the PYTHON env variable".

PYTHON=C:\Users\Russ\AppData\Local\Programs\Python\Python36\python.EXE

I've even rebooted a few times. It is ironic because it shows the correct path to Python, but then says it can't find it.

Yes, I am using a Administrator: Command Prompt.

How do I know it isn't working? When I try to execute any apic command I see this error

D:\temp\test1>apic -v
module.js:557
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\apiconnect\bin\cli.js'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:190:16)
    at bootstrap_node.js:662:3

Any other hints for a succesfull install?

Russ

Upvotes: 1

Views: 477

Answers (1)

Anouar Kacem
Anouar Kacem

Reputation: 645

This a node-gyp issue. You have to install some other libraries including python. Anyways there is an easier solution for this, without installing libraries one by one.

  1. Run Powershell as an administrator
  2. npm install --global --production windows-build-tools
  3. npm install -g apiconnect

More info about build tools here

Upvotes: 2

Related Questions