nodejs / node-gyp

Node.js native addon build tool
MIT License
9.86k stars 1.79k forks source link

Package including other binding.gyp files fails to build on native Windows with "No such file or directory" for binding.sln.gyp.9gyrmwpe.tmp #3040

Open rien opened 2 months ago

rien commented 2 months ago

My package @dodona/dolos-parsers fails to build on Windows with the following error:

npm ERR! FileNotFoundError: [Errno 2] No such file or directory: 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\@dodona\\dolos-parsers\\build\\bash\\binding.sln.gyp.9gyrmwpe.tmp'

This could be caused by how dolos-parsers is structured: it has a binding.gyp that includes other gyp-files of native modules includes as a submodule in our Git repository:

{
    "includes": [
        "bash/binding.gyp",
        "c/binding.gyp",
        ...
    ]
}

By digging through the msvs.py generator I see there are some issues with generating the sln-files within directories, so maybe that is related?

Verbose output (from npm or node-gyp): From [this GH actions run](https://github.com/dodona-edu/dolos/actions/runs/8631612300/job/23660392187?pr=1458): ``` npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm WARN cleanup 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\tree-sitter', npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\npm\prefix\node_modules\@dodona\dolos\node_modules\tree-sitter'] { npm WARN cleanup errno: -4082, npm WARN cleanup code: 'EBUSY', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\tree-sitter' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules', npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\npm\prefix\node_modules\@dodona\dolos\node_modules\tree-sitter'] { npm WARN cleanup errno: -4082, npm WARN cleanup code: 'EBUSY', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\tree-sitter' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos', npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\npm\prefix\node_modules\@dodona\dolos\node_modules\tree-sitter'] { npm WARN cleanup errno: -4082, npm WARN cleanup code: 'EBUSY', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\tree-sitter' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'C:\\npm\\prefix\\node_modules\\@dodona', npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\npm\prefix\node_modules\@dodona\dolos\node_modules\tree-sitter'] { npm WARN cleanup errno: -4082, npm WARN cleanup code: 'EBUSY', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\tree-sitter' npm WARN cleanup } npm WARN cleanup ] npm WARN cleanup ] npm ERR! code 1 npm ERR! path C:\npm\prefix\node_modules\@dodona\dolos\node_modules\@dodona\dolos-parsers npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@10.0.1 npm ERR! gyp info using node@21.7.2 | win32 | x64 npm ERR! gyp info find Python using Python version 3.12.2 found at "C:\hostedtoolcache\windows\Python\3.12.2\x64\python.exe" npm ERR! gyp http GET https://nodejs.org/download/release/v21.7.2/node-v21.7.2-headers.tar.gz npm ERR! gyp http 200 https://nodejs.org/download/release/v21.7.2/node-v21.7.2-headers.tar.gz npm ERR! gyp http GET https://nodejs.org/download/release/v21.7.2/SHASUMS256.txt npm ERR! gyp http GET https://nodejs.org/download/release/v21.7.2/win-x64/node.lib npm ERR! gyp http 200 https://nodejs.org/download/release/v21.7.2/SHASUMS256.txt npm ERR! gyp http 200 https://nodejs.org/download/release/v21.7.2/win-x64/node.lib npm ERR! gyp info find VS using VS2022 (17.9.34723.18) found at: npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" npm ERR! gyp info find VS run with --verbose for detailed information npm ERR! gyp info spawn C:\hostedtoolcache\windows\Python\3.12.2\x64\python.exe npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'C:\\hostedtoolcache\\windows\\node\\21.7.2\\x64\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'msvs', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\@dodona\\dolos-parsers\\build\\config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\\hostedtoolcache\\windows\\node\\21.7.2\\x64\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\21.7.2\\include\\node\\common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\21.7.2', npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\hostedtoolcache\\windows\\node\\21.7.2\\x64\\node_modules\\npm\\node_modules\\node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\runneradmin\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\21.7.2\\\\<(target_arch)\\\\node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\@dodona\\dolos-parsers', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\@dodona\\dolos-parsers\\build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! Traceback (most recent call last): npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 45, in npm ERR! sys.exit(gyp.script_main()) npm ERR! ^^^^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 688, in script_main npm ERR! return main(sys.argv[1:]) npm ERR! ^^^^^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 680, in main npm ERR! return gyp_main(args) npm ERR! ^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 665, in gyp_main npm ERR! generator.GenerateOutput(flat_list, targets, data, params) npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2157, in GenerateOutput npm ERR! sln = MSVSNew.MSVSSolution( npm ERR! ^^^^^^^^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 228, in __init__ npm ERR! self.Write() npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 255, in Write npm ERR! f = writer(self.path) npm ERR! ^^^^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 415, in WriteOnDiff npm ERR! return Writer() npm ERR! ^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 353, in __init__ npm ERR! tmp_fd, self.tmp_path = tempfile.mkstemp( npm ERR! ^^^^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\Python\3.12.2\x64\Lib\tempfile.py", line 357, in mkstemp npm ERR! return _mkstemp_inner(dir, prefix, suffix, flags, output_type) npm ERR! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! File "C:\hostedtoolcache\windows\Python\3.12.2\x64\Lib\tempfile.py", line 256, in _mkstemp_inner npm ERR! fd = _os.open(file, flags, 0o600) npm ERR! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! FileNotFoundError: [Errno 2] No such file or directory: 'C:\\npm\\prefix\\node_modules\\@dodona\\dolos\\node_modules\\@dodona\\dolos-parsers\\build\\bash\\binding.sln.gyp.9gyrmwpe.tmp' npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess. (C:\hostedtoolcache\windows\node\21.7.2\x64\node_modules\npm\node_modules\node-gyp\lib\configure.js:271:18) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:519:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) npm ERR! gyp ERR! System Windows_NT 10.0.20348 npm ERR! gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\21.7.2\\x64\\node.exe" "C:\\hostedtoolcache\\windows\\node\\21.7.2\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd C:\npm\prefix\node_modules\@dodona\dolos\node_modules\@dodona\dolos-parsers npm ERR! gyp ERR! node -v v21.7.2 npm ERR! gyp ERR! node-gyp -v v10.0.1 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: C:\npm\cache\_logs\2024-04-10T12_56_36_832Z-debug-0.log node:internal/modules/cjs/loader:1145 throw err; ^ Error: Cannot find module 'C:\npm\prefix\node_modules\@dodona\dolos\dist\cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1142:15) at Module._load (node:internal/modules/cjs/loader:983:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] } ```
rien commented 1 month ago

If anyone could give me some pointers what could be causing this and how I could try to debug, that would be very welcome :)

cclauss commented 1 month ago

Is this a duplicate of:

rien commented 1 month ago

@cclauss this issue you link to on our repository is indeed an occurrence of this bug.