ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

'npm install ipfs' fails on Windows 10 if Windows login (and user's home path) contains non-ASCII characters #1318

Closed brutestack closed 1 year ago

brutestack commented 6 years ago

Type:

High

Description:

Unable to install js-ipfs via npm on Windows 10 in case user's login and/or user's home path (c:\Users\[Username]) contains non-ASCII characters.

Steps to reproduce the error:

  1. Create new local Windows user with cyrillic (for example) login.
  2. Logout from current user and login as new user with cyrillic name.
  3. Install Node.JS
  4. Try installing js-ipfs globally as described in documentation / or create new node project and try 'npm install ipfs --save' in it

As a result you see errors produced by node-gyp compilati telling 'node.h' not found etc.

victorb commented 6 years ago

Does other packages work to install globally but not js-ipfs? Also, could you paste the full output of your installation log here please?

brutestack commented 6 years ago

Yes, I'm able to install other packages globally.

Here is the console output:

PS C:\Users\Пользователь\Documents\testNodeProject> npm install ipfs --save
npm WARN deprecated libp2p-multiplex@0.5.1: use libp2p-mplex instead

> fs-ext@1.0.0 install C:\Users\Пользователь\Documents\testNodeProject\node_modules\fs-ext
> node-gyp configure build

C:\Users\Пользователь\Documents\testNodeProject\node_modules\fs-ext>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build )  else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" configure build )
Выполняется последовательная сборка проектов в этом решении. Чтобы включить параллельную сборку, добавьте параметр "/m".  fs-ext.cc
  win_delay_load_hook.cc
c:\users\пользователь\documents\testnodeproject\node_modules\fs-ext\fs-ext.cc(20): fatal error C1083: Не удается открыт
ь файл включение: node.h: No such file or directory, (компилируется исходный файл ..\fs-ext.cc) [C:\Users\Пользователь\
Documents\testNodeProject\node_modules\fs-ext\build\fs-ext.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
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 10.0.16299
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build"
gyp ERR! cwd C:\Users\Пользователь\Documents\testNodeProject\node_modules\fs-ext
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

> gc-stats@1.1.1 install C:\Users\Пользователь\Documents\testNodeProject\node_modules\gc-stats
> node-pre-gyp install --fallback-to-build

[gc-stats] Success: "C:\Users\Пользователь\Documents\testNodeProject\node_modules\gc-stats\build\gcstats\v1.1.1\Release\node-v57-win32-x64\gcstats.node" is installed via remote

> keccak@1.4.0 install C:\Users\Пользователь\Documents\testNodeProject\node_modules\keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."

> keccak@1.4.0 rebuild C:\Users\Пользователь\Documents\testNodeProject\node_modules\keccak
> node-gyp rebuild

C:\Users\Пользователь\Documents\testNodeProject\node_modules\keccak>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Выполняется последовательная сборка проектов в этом решении. Чтобы включить параллельную сборку, добавьте параметр "/m".  addon.cc
  win_delay_load_hook.cc
c:\users\пользователь\documents\testnodeproject\node_modules\keccak\src\addon.cc(1): fatal error C1083: Не удается откр
ыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\addon.cc) [C:\Users\Пользова
тель\Documents\testNodeProject\node_modules\keccak\build\keccak.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
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 10.0.16299
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\Пользователь\Documents\testNodeProject\node_modules\keccak
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@1.4.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Пользователь\AppData\Roaming\npm-cache\_logs\2018-04-20T18_58_29_643Z-debug.log
"Keccak bindings compilation fail. Pure JS implementation will be used."

> secp256k1@3.5.0 install C:\Users\Пользователь\Documents\testNodeProject\node_modules\secp256k1
> npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."

> secp256k1@3.5.0 rebuild C:\Users\Пользователь\Documents\testNodeProject\node_modules\secp256k1
> node-gyp rebuild

C:\Users\Пользователь\Documents\testNodeProject\node_modules\secp256k1>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Выполняется последовательная сборка проектов в этом решении. Чтобы включить параллельную сборку, добавьте параметр "/m".  addon.cc
  privatekey.cc
  publickey.cc
  signature.cc
  ecdsa.cc
  ecdh.cc
  win_delay_load_hook.cc
c:\users\пользователь\documents\testnodeproject\node_modules\secp256k1\src\addon.cc(1): fatal error C1083: Не удается о
ткрыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\addon.cc) [C:\Users\Польз
ователь\Documents\testNodeProject\node_modules\secp256k1\build\secp256k1.vcxproj]
c:\users\пользователь\documents\testnodeproject\node_modules\secp256k1\src\ecdsa.cc(1): fatal error C1083: Не удается о
ткрыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\ecdsa.cc) [C:\Users\Польз
ователь\Documents\testNodeProject\node_modules\secp256k1\build\secp256k1.vcxproj]
c:\users\пользователь\documents\testnodeproject\node_modules\secp256k1\src\privatekey.cc(1): fatal error C1083: Не удае
тся открыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\privatekey.cc) [C:\U
sers\Пользователь\Documents\testNodeProject\node_modules\secp256k1\build\secp256k1.vcxproj]
c:\users\пользователь\documents\testnodeproject\node_modules\secp256k1\src\signature.cc(1): fatal error C1083: Не удает
ся открыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\signature.cc) [C:\Use
rs\Пользователь\Documents\testNodeProject\node_modules\secp256k1\build\secp256k1.vcxproj]
c:\users\пользователь\documents\testnodeproject\node_modules\secp256k1\src\ecdh.cc(1): fatal error C1083: Не удается от
крыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\ecdh.cc) [C:\Users\Пользов
атель\Documents\testNodeProject\node_modules\secp256k1\build\secp256k1.vcxproj]
c:\users\пользователь\documents\testnodeproject\node_modules\secp256k1\src\publickey.cc(2): fatal error C1083: Не удает
ся открыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\publickey.cc) [C:\Use
rs\Пользователь\Documents\testNodeProject\node_modules\secp256k1\build\secp256k1.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
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 10.0.16299
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\Пользователь\Documents\testNodeProject\node_modules\secp256k1
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! secp256k1@3.5.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the secp256k1@3.5.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Пользователь\AppData\Roaming\npm-cache\_logs\2018-04-20T18_58_33_983Z-debug.log
"Secp256k1 bindings compilation fail. Pure JS implementation will be used."

> sha3@1.2.0 install C:\Users\Пользователь\Documents\testNodeProject\node_modules\sha3
> node-gyp rebuild

C:\Users\Пользователь\Documents\testNodeProject\node_modules\sha3>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Выполняется последовательная сборка проектов в этом решении. Чтобы включить параллельную сборку, добавьте параметр "/m".  addon.cpp
  displayIntermediateValues.cpp
  KeccakF-1600-reference.cpp
  KeccakNISTInterface.cpp
  KeccakSponge.cpp
  win_delay_load_hook.cc
c:\users\пользователь\documents\testnodeproject\node_modules\sha3\src\addon.cpp(1): fatal error C1083: Не удается откры
ть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\src\addon.cpp) [C:\Users\Пользова
тель\Documents\testNodeProject\node_modules\sha3\build\sha3.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
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 10.0.16299
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\Пользователь\Documents\testNodeProject\node_modules\sha3
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN dirty-chai@2.0.1 requires a peer of chai@>=2.2.1 <5 but none is installed. You must install peer dependencies yourself.
npm WARN testnodeproject@1.0.0 No description
npm WARN testnodeproject@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-ext@1.0.0 (node_modules\fs-ext):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-ext@1.0.0 install: `node-gyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sha3@1.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sha3@1.2.0 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\Пользователь\AppData\Roaming\npm-cache\_logs\2018-04-20T18_58_38_131Z-debug.log
brutestack commented 6 years ago

2018-04-20T18_58_38_131Z-debug.log

justinmchase commented 6 years ago

Honestly, you're probably going to have other issues too. This library makes assumptions about linux style paths in a lot of places. I am using windows at home also and I have to use new WSL to get it to work. So I would just say use that for now.

justinmchase commented 6 years ago

This is a little old but I don't think its fundamentally changed that much: https://channel9.msdn.com/Events/Build/2016/P488

brutestack commented 6 years ago

I haven't heard about WSL feature earlier. It's very helpfull. Thank you!

daviddias commented 6 years ago

Is this still an issue with latest js-ipfs? Can anyone confirm?

brutestack commented 6 years ago

Unfortunately yes

PS C:\Users\Пользователь2\mytestproject1> npm install ipfs --global
npm WARN deprecated bignumber.js@6.0.0: Custom ALPHABET bug fixed in v7.0.2
C:\Users\Пользователь2\AppData\Roaming\npm\jsipfs -> C:\Users\Пользователь2\AppData\Roaming\npm\node_modules\ipfs\src\cli\bin.js

> fs-ext@1.0.0 install C:\Users\Пользователь2\AppData\Roaming\npm\node_modules\ipfs\node_modules\fs-ext
> node-gyp configure build

C:\Users\Пользователь2\AppData\Roaming\npm\node_modules\ipfs\node_modules\fs-ext>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build )  else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" configure build )
Выполняется последовательная сборка проектов в этом решении. Чтобы включить параллельную сборку, добавьте параметр "/m".
  fs-ext.cc
  win_delay_load_hook.cc
c:\users\пользователь2\appdata\roaming\npm\node_modules\ipfs\node_modules\fs-ext\fs-ext.cc(20): fatal error C1083: Не у
дается открыть файл включение: node.h: No such file or directory, (компилируется исходный файл ..\fs-ext.cc) [C:\Users\
Пользователь2\AppData\Roaming\npm\node_modules\ipfs\node_modules\fs-ext\build\fs-ext.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
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 10.0.17134
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build"
gyp ERR! cwd C:\Users\Пользователь2\AppData\Roaming\npm\node_modules\ipfs\node_modules\fs-ext
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN dirty-chai@2.0.1 requires a peer of chai@>=2.2.1 <5 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-ext@1.0.0 (node_modules\ipfs\node_modules\fs-ext):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-ext@1.0.0 install: `node-gyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ ipfs@0.29.3
updated 1 package in 106.025s

Last line declares that something is updated, but we see same errors from gyp saying it can't find 'node.h'. As a result jsipfs CLI is not available.

autonome commented 4 years ago

@hacdias Can you test with latest js-ipfs? Or @aschmahmann?

hacdias commented 4 years ago
  1. Created a user with an emoji on its username.
  2. Run npm i -g ipfs
  3. Result: (some Unicode decoding error)

image

achingbrain commented 4 years ago

Is this problem specific to IPFS or does it happen with any module that has a native module as a dependency?

justinmchase commented 4 years ago

It looks like its in the fs-ext module... here.

Looking at the way it builds it looks pretty standard, it seems like it should work on windows with unicode path characters. Try installing some other native module like npm i sass -g and if that fails with the same error then its probably an issue in node-gyp, though its such an important module I'd have a real hard to believing that they simply forgot to support unicode paths, it would be weird.

As a workaround, if you move your code to C:/code with no unicode characters and try it again and see if it works.

hacdias commented 4 years ago
achingbrain commented 1 year ago

If this is still an problem an issue should be opened against npm.