sonixd icon indicating copy to clipboard operation
sonixd copied to clipboard

Cannot install dependencies on windows after cloning directory

Open Neurrone opened this issue 4 years ago • 4 comments

Describe the bug

There's a compilation error about missing v8.h when trying to run yarn.

To Reproduce

  1. Run yarn when in the project folder to install.

Expected behavior The dependencies install successfully

I first see the following error:

npm ERR! code ELSPROBLEMS                                                                                                            
npm ERR! invalid: [email protected] D:\source\sonixd\node_modules\register-scheme                                                
{                                                                                                                                    
  "error": {                                                                                                                         
    "code": "ELSPROBLEMS",                                                                                                           
    "summary": "invalid: [email protected] D:\\source\\sonixd\\node_modules\\register-scheme",                                   
    "detail": ""                                                                                                                     
  }                                                                                                                                  
}                                                                                                                                    

This is followed by:

$ node -r @babel/register .erb/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.babel.js && opencollective-postinstall && yarn-deduplicate yarn.lock
Native dependencies could not be checked
  • electron-builder  version=22.10.5
  • loaded configuration  file=package.json ("build" field)
  • installing production dependencies  platform=win32 arch=x64 appDir=D:\source\sonixd\src
  ⨯ C:\Program Files\nodejs\node.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Output:

Output:
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Error output:

Error output:
error D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media.playback: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media.playback
Output:
D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media.playback>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.10.1 found at "C:\Users\Dickson\.pyenv\pyenv-win\versions\3.10.1\python3.exe"
gyp info find VS using VS2022 (17.0.32112.339) found at:
gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\Dickson\.pyenv\pyenv-win\versions\3.10.1\python3.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\Dickson\\AppData\\Roaming\\nvm\\v16.14.0\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\source\\sonixd\\src\\node_modules\\@nodert-win10-au\\windows.media.playback\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\source\\sonixd\\src\\node_modules\\@nodert-win10-au\\windows.media.playback\\common.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Dickson\\AppData\\Roaming\\nvm\\v16.14.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Dickson\\.electron-gyp\\13.6.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Dickson\\.electron-gyp\\13.6.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Dickson\\AppData\\Roaming\\nvm\\v16.14.0\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Dickson\\\\.electron-gyp\\\\13.6.3\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\source\\sonixd\\src\\node_modules\\@nodert-win10-au\\windows.media.playback',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\source\\sonixd\\src\\node_modules\\@nodert-win10-au\\windows.media.playback\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  _nodert_generated.cpp
D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media.playback\_nodert_generated.cpp(19,10): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media.playback\build\binding.vcxproj]
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Dickson\AppData\Roaming\nvm\v16.14.0\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media.playback
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok

Desktop (please complete the following information):

  • OS: Windows 10 10.0.19044.1526]
  • Version latest master

Additional context Add any other context about the problem here.

Neurrone avatar Feb 13 '22 12:02 Neurrone

The NodeRT Windows native-dependency was added in the previous release which made setting up the dev environment a bit more tricky on Windows (and I haven't updated the README yet).

Here's some steps that I used:

  1. Installed nodejs including the optional build dependencies from the installer (Alternatively you can install VS Build tools separately, though it may or may not work properly)
  2. Install nvm and force npm to use 14.16.1
  3. Install yarn globally
  4. Install Windows 10 SDK 10.0.14393.0 (this is required for nodert-win10-au)
  5. (May or may not need this step) Copy platform.winmd from C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x86\store\references to C:\Program Files (x86)\Windows Kits\10\UnionMetadata (Needs both platform.winmd and Windows.winmd in that folder)

After doing the above, do this in the following order (the github publish action is using this):

  • cd to the src folder of the repo and run yarn --frozen-lockfile --ignore-scripts --network-concurrency 1 --network-timeout 300000
  • cd to the root folder of the repo and run yarn install --frozen-lockfile --ignore-scripts --prefer-offline --network-concurrency 1 --network-timeout 300000
  • in the root folder of the repo run yarn install --frozen-lockfile --prefer-offline --network-concurrency 1 --network-timeout 300000

After that, you should be able to run with yarn start

If you receive an error with Error: Electron failed to install correctly, please delete node_modules/electron and try installing again, cd to the node_modules/electron directory and run node install.js to install it

jeffvli avatar Feb 13 '22 12:02 jeffvli

I get the following error:

d:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media\opaquewrapper.h(18): fatal error C1083: Cannot open include file: 'node.h': No such file or directory (compiling source file ..\OpaqueWrapper.cpp) [D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media\build\binding.vcxproj]
d:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media\nodertutils.h(18): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory (compiling source file ..\NodeRtUtils.cpp) [D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media\build\binding.vcxproj]
d:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media\_nodert_generated.cpp(19): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [D:\source\sonixd\src\node_modules\@nodert-win10-au\windows.media\build\binding.vcxproj]

I'm finding it incredibly difficult to set up. What is that package being used for?

Neurrone avatar Feb 13 '22 14:02 Neurrone

It handles the (optional) Windows media controls API that was added in #171. You can remove the packages from /src/package.json and comment out 283-379 the section on src/main.dev.js if you're having trouble getting it to build. https://github.com/jeffvli/sonixd/blob/85bd3d391c74b57566f8cbe97e4f2a0288b5918b/src/package.json#L17-L20 https://github.com/jeffvli/sonixd/blob/85bd3d391c74b57566f8cbe97e4f2a0288b5918b/src/main.dev.js#L283-L379

Also you could try deleting your node_modules folder, running yarn cache clean and deleting the C:\Users\$yourUsername\.electron-gyp folder and then try rebuilding.

jeffvli avatar Feb 13 '22 14:02 jeffvli

Thanks, commenting / removing the packages works.

Any way this could be made an optional dependency to make the setup easier? So that only people who're working on that feature need to have that configured?

Neurrone avatar Feb 14 '22 07:02 Neurrone