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?

addaleax avatar Jul 01 '16 08:07 addaleax

Thanks a lot, @addaleax :+1:

Something wrong happened:

"...\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc':** No such file or directory

after npm -g install npm@next

So I did that:

cd "...\npm\node_modules\npm\
npm install

It works, finally

zetsin avatar Jul 01 '16 09:07 zetsin

Something wrong happened:

That does not look like something that should happen. Do you still have the npm-debug.log from that installation attempt?

addaleax avatar Jul 01 '16 09:07 addaleax

Let me do it again.

rd/s/q "...\npm\node_modules\npm"
npm -g install npm@next
cd "...\npm\node_modules\npm\node_modules\node-gyp"
dir

I found that there is no "src" folder in "node-gyp", so the wrong happened when i use node-gyp build(e.g. npm install ref)

"...\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc':** No such file or directory

zetsin avatar Jul 01 '16 10:07 zetsin

cd "...\npm\node_modules\npm\node_modules\node_gyp"

Is that a typo? The directory is called 'node-gyp', not 'node_gyp'.

bnoordhuis avatar Jul 01 '16 11:07 bnoordhuis

Yeah, its a typo I have edited, i'm so sorry. @bnoordhuis

zetsin avatar Jul 01 '16 11:07 zetsin

No problem. Just to be sure, can you delete your node_modules directory and install npm@next again?

If you still can't build ref, can you post the full build log of npm install ref?

bnoordhuis avatar Jul 01 '16 12:07 bnoordhuis

I found a workaround, go to AppData\Roaming\npm\node_modules\npm and type npm remove node-gyp then npm install node-gyp.

I think this is due to using npm-windows-upgrade. It guides to use --production flag so I guess it installs npm with --production too. So node-gyp was missing src/.

First I had a problem that the upgrade was installing [email protected] and it had the previous node-gyp. I posted a comment about it. So I had [email protected] in my global node_modules but 3.3.1 inside npm.

Anyway, now I'm finally able to build. :)

RanzQ avatar Jul 01 '16 12:07 RanzQ

fwiw npm@next is probably not going to fix this, yet, there was a problem in the upgrade that went out with 3.10.4, see https://github.com/npm/npm/issues/13256 (my fault somehow I believe). It's been fixed in tree and I imagine it'll be out soon in a 3.10.5. npm@2 works fine though if you're able to use v2.

rvagg avatar Jul 05 '16 10:07 rvagg

@rvagg I think I may have the same issue with npm 2.14.12. I have pretty much the same environment as @zetsingithub, except for the npm version. I was trying to install mariasql and got:

win_delay_load_hook.c
C:\Users\Andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\w
in_delay_load_hook.c(31): error C2373: '__pfnDliNotifyHook2': redefinition; dif
ferent type modifiers [D:\Projects\betarena_chat\node_modules\mariasql\build\de
ps\libmariadbclient\mysys_ssl\mysys_ssl.vcxproj]
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134
  ): note: see declaration of '__pfnDliNotifyHook2'

Do you know if this issue might affect npm@2 as well?

andrezzoid avatar Jul 06 '16 10:07 andrezzoid

yep, you need 2.15.9: https://github.com/npm/npm/releases/tag/v2.15.9 I think npm i npm@2 -g should be enough to upgrade you, we don't carry it in our Node LTS releases yet but it'll get there.

rvagg avatar Jul 07 '16 11:07 rvagg

@rvagg That did the trick, Thank you!

Vasanthrajan avatar Jul 09 '16 05:07 Vasanthrajan

Had the same issue, npm -g install npm@next fixed it for me, if anyone else is in the same boat.

SwadicalRag avatar Jul 11 '16 08:07 SwadicalRag

npm -g install npm@next appears to be the magic sauce. Thanks for posting that!

DThompson55 avatar Jul 11 '16 16:07 DThompson55

Same here. I tried to install the oracledb module and got the same redefinition; different type modifiers for __pfnDliNotifyHook2 error. Doing a npm -g install npm@next did fix this issue.

httpdigest avatar Jul 11 '16 17:07 httpdigest

npm -g install npm@latest should do the trick now that it's been pushed out in a stable release, no need to jump forward to next which can sometimes contain regressions.

rvagg avatar Jul 12 '16 05:07 rvagg

Hade the exact problem when trying to install node module "bcrypt". Installed it without any errors now, cheers!

swe-jack avatar Aug 28 '16 16:08 swe-jack

I had same problem with "os-service", but I have a solution also. npm install os-service --force && cd node_modules\os-service && node-gyp configure && node-gyp rebuild

konyee avatar Sep 01 '16 15:09 konyee

I had a lot of trouble getting this working for Oracle drive...same error with node-gyp. These are the prerequisites. I think this will also work for other versions of Visual Studio but I used the lastest Community edition 2015.

You must have at least 3.10.8 version of NPM. This is critical. npm -g install npm@next

Make sure Node globally uses the same version 2015 npm config set msvs_version 2015 --global

  1. Delete node_modules directory in your project
  2. npm install

redrockzee avatar Sep 28 '16 16:09 redrockzee

if you are working on an old version like I was, a simple npm install -g npm (without the @next) worked.

jasonswearingen avatar Oct 07 '16 03:10 jasonswearingen