node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

error C2373: '__pfnDliNotifyHook2': redefinition;

Open zetsin opened this issue 10 years ago • 29 comments

  • ERR
 win_delay_load_hook.c
C:\Users\zetsin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373:
'__pfnDliNotifyHook2': redefinition; different type modifiers [D:\GitHub\node-winode\node_modules\ref\build\binding.vcx
proj]
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: see declaration of '__pfnDliNot
  ifyHook2'
  • WHILE
npm install ref
  • ENV
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

>node -v
v4.4.7
>npm -v
3.10.2
>node-gyp -v
v3.4.0
>python -V
Python 2.7.12
>msbuild /ver
14.0.25420.1

zetsin avatar Jul 01 '16 08:07 zetsin

npm -g install npm@next worked. Thanks.

chrismark avatar Nov 02 '16 10:11 chrismark

For me npm i -g npm@next didn't work, but the trick from @RanzQ to reinstall node-gyp worked ! Thanks a lot this was driving me crazy

ocombe avatar Nov 03 '16 16:11 ocombe

What shall I do if I don't want to use next? Because I hate flatten dependencies.

XadillaX avatar Jan 18 '17 11:01 XadillaX

@XadillaX It’s been a while since you had to use npm@next to resolve this; just upgrade your npm or node to the latest version and you should be fine.

addaleax avatar Jan 18 '17 11:01 addaleax

just to note that npm install -g npm@next broke my npm x.x so i uninstalled node and installed again, tried it all again and the npm got broken again. Any command i try to execute, even only "npm" just causes a lot of errors like "cannot find npmlog module".

Need to say that i'm using nvm to install and use node 5.3.0 as my old project needs. And the first issue i had was installing node-oracledb. This project worked months ago, and it still works in my macosx but in windows i'm with these errors.

Will try to install node 5.3.0 and use just npm install -g npm as @jasonswearingen suggested

jradesenv avatar Apr 25 '17 15:04 jradesenv

note: most of the workarounds here recommend upgrading node-gyp by upgrading npm, which is fine. But in some cases users may instead wish to upgrade just node-gyp, which also fixes this issue (since the underlying bug was fixed in https://github.com/nodejs/node-gyp/pull/952).

springmeyer avatar May 30 '17 21:05 springmeyer

@springmeyer I am using node-gyp v3.6.2 and still having this problem (node v6.11.0 and npm v3.10.10). Does that release contain the fix you mentioned?

jacobq avatar Jun 21 '17 19:06 jacobq

Yes @jacobq - as far as I can tell the fix landed in v3.3.3: https://github.com/nodejs/node-gyp/issues/956. Perhaps you have an older version being invoked without realizing it?

springmeyer avatar Jun 21 '17 20:06 springmeyer

(Edited) @springmeyer Whoa, I think you're right, but I have no idea why this is happening. Any ideas how it might get stuck at an old version? For example, is it possible for another module to list it in package.json or something?

The error is happening in node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c on the line

PfnDliHook __pfnDliNotifyHook2 = load_exe_hook;

which was fixed/changed in node-gyp in https://github.com/nodejs/node-gyp/commit/f31482e2260e3beb90d959c62135e5e95c06ed4d in June 2016, and I think it was part of the fix you mentioned. Trying to see where this file was coming from I went up a few levels to node_modules\npm\node_modules\node-gyp\package.json and found this:

{
  "_args": [
    [
      "node-gyp@~3.2.1",
      "/Users/ogd/Documents/projects/npm/npm"
    ]
  ],
  "_from": "node-gyp@>=3.2.1 <3.3.0",
  "_id": "[email protected]",
  "_inCache": true,
  "_installable": true,
  "_location": "/npm/node-gyp",
  "_nodeVersion": "6.0.0-pre",
  "_npmUser": {
    "email": "[email protected]",
    "name": "bnoordhuis"
  },
  "_npmVersion": "3.3.12",
...

It looks like that was installed because npm (why is that in node_modules??) required: "node-gyp": "~3.2.1".

Update: Ah, I think I finally found it! The culprit was ember-cli-release because of https://github.com/lytics/ember-cli-release/blob/3ea88c52e575c52b901e08b0dd900926b759d0b0/package.json#L30

jacobq avatar Jun 22 '17 15:06 jacobq