Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when "npm install" #4

Closed
parazitenew opened this issue Jan 5, 2018 · 3 comments
Closed

error when "npm install" #4

parazitenew opened this issue Jan 5, 2018 · 3 comments

Comments

@parazitenew
Copy link

parazitenew commented Jan 5, 2018

Hi,
I'm on Win7 x64, I have:
node 8.9.4
npm 5.6.0
node-gyp 3.6.2
opencv installed and env. variables declared:
OPENCV_DIR = C:\opencv\build\x64\vc14
OPENCV_INCLUDE_DIR = C:\opencv\build\include
OPENCV_LIB_DIR = %OPENCV_DIR%\lib

I downloaded this zip in my project folder. then I run "npm install" and got this error:

KeyError: '2017'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Imed\Projets electrons\opencv\node_modules\opencv4nodejs
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [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!     C:\Users\Imed\AppData\Roaming\npm-cache\_logs\2018-01-05T22_27_14_778Z-debug.log

When I use "npm start", the app runs with console error that say can't find module 'opencv4nodejs' . Inside "node_modules" there is no "opencv4nodejs" folder. that means it could not be installed. So I tried to do it manually by downloading the whole opencv4nodejs plugin (21MB) from here https://github.com/justadudewhohacks/opencv4nodejs#how-to-install , and put it inside node_modules, then I run "npm start", this time the console said "can't find module ../build/Release/opencv4nodejs.

I also tried this:

node-gyp rebuild

but it throwed error too:

module.js:540
    throw err;
    ^

Error: Cannot find module 'C:\Users\Imed\Projets electrons\opencv\lib\includes.js'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
gyp: Call to 'node ./lib/includes.js' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\Imed\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Imed\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Imed\Projets electrons\opencv
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Any idea? Thanks.

@justadudewhohacks
Copy link
Owner

Hey,

The first error you posted KeyError: '2017' is a node-gyp issue with VS 2017 on windows. If you run npm config get can you verify that msvs_version = "2017" is set? Otherwise do npm config set msvs_version=2017. The issue you posted seems to be the same as: nodejs/node-gyp#1179.

The second log you posted when running node-gyp directly seems strange to me. Looks like a path issue, but after fixing that one you will probably run into the other issue as well.

@parazitenew
Copy link
Author

Hi, thanks for the answer.

npm get config return this:
msvs_version = "2017"

@justadudewhohacks
Copy link
Owner

Going to close this, as it is an issue with node-gyp and msvs2017.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants