steelbrain / package-deps

Automatically install dependencies for your atom packages
MIT License
59 stars 20 forks source link

Installing package with dependencies fails on Windows #101

Closed THE-FYP closed 7 years ago

THE-FYP commented 7 years ago

Attempting to install a package with any dependency from repository instead of npm registry (e.g. "package-deps": "github:steelbrain/package-deps" instead of "package-deps": "latest") leads to the following error:

C:\Users\username\.atom\packages\defold-ide\node_modules\atom-package-deps\lib\view.js:64 [Package-Deps] Unable to install autocomplete-lua, Error: npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-1df252af C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-15c834e3\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: Cloning into 'C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-15c834e3\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b'...
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-1df252af C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-15c834e3\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: error: cannot spawn sh: No such file or directory
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-1df252af C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-15c834e3\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: fatal: unable to fork
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-1df252af C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-15c834e3\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: 
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-https-github-com-dapetcu21-luaparse-git-7c30d46c C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-a4a3f540\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: Cloning into 'C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-a4a3f540\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b'...
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-https-github-com-dapetcu21-luaparse-git-7c30d46c C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-a4a3f540\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: error: cannot spawn sh: No such file or directory
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-https-github-com-dapetcu21-luaparse-git-7c30d46c C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-a4a3f540\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: fatal: unable to fork
npm ERR! git clone C:\Users\username\.atom\.apm\_git-remotes\git-https-github-com-dapetcu21-luaparse-git-7c30d46c C:\Users\username\AppData\Local\Temp\npm-13068-09b790b7\git-cache-a4a3f540\5a1fd2868adecb79f6bc57ee1f1880a3ea83ad8b: 
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit 
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:206:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:877:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm WARN addRemoteGit  dapetcu21/luaparse resetting remote C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9 because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit 
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:206:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:877:16)
npm WARN addRemoteGit     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! git clone --template=C:\Users\username\.atom\.apm\_git-remotes\_templates --mirror git@github.com:dapetcu21/luaparse.git C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9: Cloning into bare repository 'C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9'...
npm ERR! git clone --template=C:\Users\username\.atom\.apm\_git-remotes\_templates --mirror git@github.com:dapetcu21/luaparse.git C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9: error: cannot spawn ssh: No such file or directory
npm ERR! git clone --template=C:\Users\username\.atom\.apm\_git-remotes\_templates --mirror git@github.com:dapetcu21/luaparse.git C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9: fatal: unable to fork
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Users\\root\\AppData\\Local\\atom\\app-1.16.0\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\root\\AppData\\Local\\atom\\app-1.16.0\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\root\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\root\\.atom\\.apmrc" "install" "C:\\Users\\root\\AppData\\Local\\Temp\\d-117319-14696-7sk09q.yejj7nwmi\\package.tgz" "--runtime=electron" "--target=1.3.13" "--arch=x64" "--global-style" "--production" "--msvs_version=2012"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.5
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\username\.atom\.apm\_git-remotes\_templates --mirror git@github.com:dapetcu21/luaparse.git C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9
npm ERR! Cloning into bare repository 'C:\Users\username\.atom\.apm\_git-remotes\git-github-com-dapetcu21-luaparse-git-b80768f9'...
npm ERR! error: cannot spawn ssh: No such file or directory
npm ERR! fatal: unable to fork
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\username\AppData\Local\Temp\apm-install-dir-117319-14696-jlnq3m.0x6zpycik9\npm-debug.log

Tested on Windows 7, Windows 10 and Linux, using the latest version of package-deps and Atom v1.16.0. Error occurs only in Windows. Example package: atom-defold-ide - it installs package autocomplete-lua, which has dependency that installs from repository.

steelbrain commented 7 years ago

Hi @THE-FYP

You should not install package-deps from github, you should install install it from atom-package-deps @ NPM

THE-FYP commented 7 years ago

@steelbrain, I don't install package-deps from github, it was just an example. This problem occurs in any package that has dependencies installing from a repository. And this happens only when package installs through package-deps.

Example package: atom-defold-ide - it installs package autocomplete-lua, which has dependency that installs from repository.

steelbrain commented 7 years ago

atom-package-deps under the hood checks if a package is installed or not, if it's not, it does apm install $package_name. APM handles all the github auth and everything so it's most likely a bug in APM itself (just like the stack trace suggests)

THE-FYP commented 7 years ago

Installing package directly from command prompt using apm install autocomplete-lua --production --color false (the same command as package-deps uses for the defold-ide installation, as i understand) does not cause any errors and succeeds.

steelbrain commented 7 years ago

After a thorough examination of the error, I'm blaming this one on env variables. Can you please post your env variables for your user? (make sure to remove any that contain sensitive info)

THE-FYP commented 7 years ago

Sure.

From Atom:

APPDATA:"C:\Users\root\AppData\Roaming"
ATOM_HOME:"C:\Users\root\.atom"
BOOST_ROOT:"D:\Dev\SDK\boost\boost_1_60_0"
COMPUTERNAME:"FYP"
ComSpec:"C:\WINDOWS\system32\cmd.exe"
CommonProgramFiles:"C:\Program Files\Common Files"
CommonProgramFiles(x86):"C:\Program Files (x86)\Common Files"
CommonProgramW6432:"C:\Program Files\Common Files"
DXSDK_DIR:"D:\Dev\SDK\DXSDK"
FPS_BROWSER_APP_PROFILE_STRING:"Internet Explorer"
FPS_BROWSER_USER_PROFILE_STRING:"Default"
HOMEDRIVE:"C:"
HOMEPATH:"\Users\root"
LOCALAPPDATA:"C:\Users\root\AppData\Local"
LOGONSERVER:"\\FYP"
NODE_ENV:"production"
NODE_PATH:"C:\Users\root\AppData\Local\atom\app-1.16.0\resources\app.asar\exports"
OS:"Windows_NT"
PATHEXT:".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW"
PSModulePath:"C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\WindowsPowerShell\Modules\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\Storage\"
PUBLIC:"C:\Users\Public"
Path:"D:\Python27\;D:\Python27\Scripts;D:\Python\Scripts\;D:\Python\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Calibre2\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;D:\Program Files\Installed Programs\CMake\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;D:\Program Files\SDK\Tesseract-OCR;D:\Dev\SDK\Perl\c\bin;D:\Dev\SDK\Perl\perl\site\bin;D:\Dev\SDK\Perl\perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;D:\Python\Scripts\;D:\Python\;D:\Program Files\Installed Programs\CMake\bin;D:\Program Files\Installed Programs\GnuWin32\bin;D:\Dev\SDK\LuaJIT-2.0.4\src;C:\Users\root\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\LuaRocks\;C:\Users\root\AppData\Local\atom\bin"
ProgramData:"C:\ProgramData"
ProgramFiles:"C:\Program Files"
ProgramFiles(x86):"C:\Program Files (x86)"
ProgramW6432:"C:\Program Files"
RWGDIR:"D:/Dev/RW/Graphics"
RWGSDK:"D:/Dev/RW/Graphics/rwsdk"
RWOESDK:"D:\Dev\RW/shared/OpenExport"
SDK_DIR:"D:\Dev\SDK"
SESSIONNAME:"Console"
SystemDrive:"C:"
SystemRoot:"C:\WINDOWS"
TEMP:"C:\Users\root\AppData\Local\Temp"
TESSDATA_PREFIX:"D:\Program Files\SDK\Tesseract-OCR\tessdata"
TMP:"C:\Users\root\AppData\Local\Temp"
USERDOMAIN:"FYP"
USERDOMAIN_ROAMINGPROFILE:"FYP"
USERNAME:"root"
USERPROFILE:"C:\Users\root"
VBOX_MSI_INSTALL_PATH:"D:\Program Files\Installed Programs\VBox\"
VS90COMNTOOLS:"D:\Program Files\Installed Programs\MSVCPP2008\Common7\Tools\"
VS110COMNTOOLS:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\"
VS120COMNTOOLS:"D:\Program Files\Installed Programs\MSVS2013\Common7\Tools\"
VS140COMNTOOLS:"D:\Program Files\Installed Programs\Visual Studio 2015\Common7\Tools\"
VSSDK140Install:"D:\Program Files\Installed Programs\Visual Studio 2015\VSSDK\"
WIX:"C:\Program Files (x86)\WiX Toolset v3.10\"
windir:"C:\WINDOWS"

From command prompt:

ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\root\AppData\Roaming
BOOST_ROOT=D:\Dev\SDK\boost\boost_1_60_0
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=FYP
ComSpec=C:\WINDOWS\system32\cmd.exe
DXSDK_DIR=D:\Dev\SDK\DXSDK
ELECTRON_ENABLE_LOGGING=YES
EXPECT_OUTPUT=YES
HOMEDRIVE=C:
HOMEPATH=\Users\root
LOCALAPPDATA=C:\Users\root\AppData\Local
LOGONSERVER=\\FYP
OS=Windows_NT
Path=D:\Python27\;D:\Python27\Scripts;D:\Python\Scripts\;D:\Python\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Calibre2\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;D:\Program Files\Installed Programs\CMake\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;D:\Program Files\SDK\Tesseract-OCR;D:\Dev\SDK\Perl\c\bin;D:\Dev\SDK\Perl\perl\site\bin;D:\Dev\SDK\Perl\perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;D:\Program Files\Installed Programs\GnuWin32\bin;D:\Dev\SDK\LuaJIT-2.0.4\src;C:\Users\root\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\LuaRocks\;C:\Users\root\AppData\Local\atom\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSARGS=--version
PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\WindowsPowerShell\Modules\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\Storage\
PUBLIC=C:\Users\Public
RWGDIR=D:/Dev/RW/Graphics
RWGSDK=D:/Dev/RW/Graphics/rwsdk
RWOESDK=D:\Dev\RW/shared/OpenExport
SDK_DIR=D:\Dev\SDK
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\root\AppData\Local\Temp
TESSDATA_PREFIX=D:\Program Files\SDK\Tesseract-OCR\tessdata
TMP=C:\Users\root\AppData\Local\Temp
USERDOMAIN=FYP
USERDOMAIN_ROAMINGPROFILE=FYP
USERNAME=root
USERPROFILE=C:\Users\root
VBOX_MSI_INSTALL_PATH=D:\Program Files\Installed Programs\VBox\
VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
VS120COMNTOOLS=D:\Program Files\Installed Programs\MSVS2013\Common7\Tools\
VS140COMNTOOLS=D:\Program Files\Installed Programs\Visual Studio 2015\Common7\Tools\
VS90COMNTOOLS=D:\Program Files\Installed Programs\MSVCPP2008\Common7\Tools\
VSSDK140Install=D:\Program Files\Installed Programs\Visual Studio 2015\VSSDK\
windir=C:\WINDOWS
WIX=C:\Program Files (x86)\WiX Toolset v3.10\

Also i tested it on another computer and have the same issue. After that i asked my friend to check it and he has no problem, he uses Windows 7 and Atom v1.16.0 but 32-bit version, so maybe that's the case?

Arcanemagus commented 7 years ago

Hmmm, it seems apm is expanding the environment in some manner when launched from a shell vs. executed directly.

This isn't an issue with the environment size missing parts of your %PATH% as mine is larger than yours and it still fails... but in a different place. Yours is failing due to a missing ssh, while mine fails later with a missing sh (since I have ssh in my PATH).

However, like you when I run apm install autocomplete-lua it completes, and I can see it launching a sh.exe, so apm is doing something odd here...

Arcanemagus commented 7 years ago

Looked into this more, the only difference between this package and Atom's settings-view in installing packages is this package uses exec to spawn apm, while settings-view uses Atom's BufferedProcess. Since the environment expansion provided from exec isn't necessary as Atom is giving the full path, it might be best to remove that extra moving part and just use BufferedProcess.

serafeimgr commented 7 years ago

I can also reproduce this

THE-FYP commented 7 years ago

Can you please publish the release, so i can test it?

steelbrain commented 7 years ago

Hi @THE-FYP I would love to

Delaying it by a day or two in case something else comes up that we have to include in the latest release.