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

Cannot install dependencies on windows after cloning directory #232

Open
Neurrone opened this issue Feb 13, 2022 · 4 comments
Open

Cannot install dependencies on windows after cloning directory #232

Neurrone opened this issue Feb 13, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Neurrone
Copy link
Contributor

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 Neurrone added the bug Something isn't working label Feb 13, 2022
@jeffvli
Copy link
Owner

jeffvli commented Feb 13, 2022

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

@Neurrone
Copy link
Contributor Author

Neurrone commented Feb 13, 2022

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?

@jeffvli
Copy link
Owner

jeffvli commented Feb 13, 2022

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.

sonixd/src/package.json

Lines 17 to 20 in 85bd3d3

"@nodert-win10-au/windows.foundation": "^0.4.4",
"@nodert-win10-au/windows.media": "^0.4.4",
"@nodert-win10-au/windows.media.playback": "^0.4.4",
"@nodert-win10-au/windows.storage.streams": "^0.4.4",

sonixd/src/main.dev.js

Lines 283 to 379 in 85bd3d3

if (isWindows() && isWindows10()) {
const windowsMedia = require('@nodert-win10-au/windows.media');
const windowsMediaPlayback = require('@nodert-win10-au/windows.media.playback');
const windowsStorageStreams = require('@nodert-win10-au/windows.storage.streams');
const windowsFoundation = require('@nodert-win10-au/windows.foundation');
const Controls = windowsMediaPlayback.BackgroundMediaPlayer.current.systemMediaTransportControls;
if (settings.getSync('systemMediaTransportControls')) {
Controls.isEnabled = true;
} else {
Controls.isEnabled = false;
}
ipcMain.on('enableSystemMediaTransportControls', () => {
Controls.isEnabled = true;
});
ipcMain.on('disableSystemMediaTransportControls', () => {
Controls.isEnabled = false;
});
Controls.isChannelUpEnabled = false;
Controls.isChannelDownEnabled = false;
Controls.isFastForwardEnabled = false;
Controls.isRewindEnabled = false;
Controls.isRecordEnabled = false;
Controls.isPlayEnabled = true;
Controls.isPauseEnabled = true;
Controls.isStopEnabled = true;
Controls.isNextEnabled = true;
Controls.isPreviousEnabled = true;
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.closed;
Controls.displayUpdater.type = windowsMedia.MediaPlaybackType.music;
Controls.displayUpdater.musicProperties.title = 'Sonixd';
Controls.displayUpdater.musicProperties.artist = 'No Track Playing';
Controls.displayUpdater.musicProperties.albumTitle = 'No Album Playing';
Controls.displayUpdater.update();
Controls.on('buttonpressed', (sender, eventArgs) => {
switch (eventArgs.button) {
case windowsMedia.SystemMediaTransportControlsButton.play:
play();
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.playing;
break;
case windowsMedia.SystemMediaTransportControlsButton.pause:
pause();
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.paused;
break;
case windowsMedia.SystemMediaTransportControlsButton.stop:
stop();
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.stopped;
break;
case windowsMedia.SystemMediaTransportControlsButton.next:
nextTrack();
break;
case windowsMedia.SystemMediaTransportControlsButton.previous:
previousTrack();
break;
default:
break;
}
});
ipcMain.on('playpause', (_event, arg) => {
if (arg.status === 'PLAYING') {
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.playing;
} else {
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.paused;
}
});
ipcMain.on('current-song', (_event, arg) => {
if (Controls.playbackStatus !== windowsMedia.MediaPlaybackStatus.playing) {
Controls.playbackStatus = windowsMedia.MediaPlaybackStatus.playing;
}
Controls.displayUpdater.musicProperties.title = arg.title || 'Unknown Title';
Controls.displayUpdater.musicProperties.artist =
arg.artist?.length !== 0
? arg.artist?.map((artist) => artist.title).join(', ')
: 'Unknown Artist';
Controls.displayUpdater.musicProperties.albumTitle = arg.album || 'Unknown Album';
Controls.displayUpdater.thumbnail = windowsStorageStreams.RandomAccessStreamReference.createFromUri(
new windowsFoundation.Uri(
arg.image.includes('placeholder')
? 'https://raw.githubusercontent.com/jeffvli/sonixd/main/src/img/placeholder.png'
: arg.image
)
);
Controls.displayUpdater.update();
});
}

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.

@Neurrone
Copy link
Contributor Author

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?

MonzterDev added a commit to MonzterDev/sonixd that referenced this issue Jul 9, 2023
- Removed Windows Media Keys because they prevented building: jeffvli#232
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants