Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

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

Closed
brutestack opened this issue Apr 20, 2018 · 14 comments
Assignees
Labels
env:Windows kind/bug A bug in existing code (including security flaws) need/analysis Needs further analysis before proceeding P2 Medium: Good to have, but can wait until someone steps up

Comments

@brutestack
Copy link

  • Version:
    js-ipfs version: 0.28.2-
    Repo version: 6
    System version: x64/win32
    Node.js version: v8.11.1

  • Platform:
    Windows 10 Home edition 64 bit

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
Copy link
Member

victorb commented Apr 20, 2018

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
Copy link
Author

brutestack commented Apr 20, 2018

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 [email protected]: use libp2p-mplex instead

> [email protected] 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

> [email protected] 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

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


> [email protected] 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! [email protected] rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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."

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


> [email protected] 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! [email protected] rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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."

> [email protected] 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 [email protected] requires a peer of chai@>=2.2.1 <5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fs-ext):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

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\Пользователь\AppData\Roaming\npm-cache\_logs\2018-04-20T18_58_38_131Z-debug.log

@brutestack
Copy link
Author

@justinmchase
Copy link

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
Copy link

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

@brutestack
Copy link
Author

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

@daviddias daviddias added the kind/bug A bug in existing code (including security flaws) label May 30, 2018
@daviddias
Copy link
Member

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

@daviddias daviddias added P2 Medium: Good to have, but can wait until someone steps up env:Windows status/ready Ready to be worked labels Jun 4, 2018
@brutestack
Copy link
Author

Unfortunately yes

PS C:\Users\Пользователь2\mytestproject1> npm install ipfs --global
npm WARN deprecated [email protected]: 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

> [email protected] 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 [email protected] 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: [email protected] (node_modules\ipfs\node_modules\fs-ext):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
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
Copy link
Contributor

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

@hugomrdias hugomrdias added need/analysis Needs further analysis before proceeding and removed status/ready Ready to be worked labels May 21, 2020
@hacdias
Copy link
Member

hacdias commented May 21, 2020

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

image

@achingbrain
Copy link
Member

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

@justinmchase
Copy link

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
Copy link
Member

hacdias commented May 22, 2020

  • npm i sass -g works.
  • npm i tiny-secp256k1 -g fails.

@achingbrain
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
env:Windows kind/bug A bug in existing code (including security flaws) need/analysis Needs further analysis before proceeding P2 Medium: Good to have, but can wait until someone steps up
Projects
No open projects
Status: Done
Development

No branches or pull requests

8 participants