nodejs / nodejs/node-gyp

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

Open
#3,040 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

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:

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 <module>
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.<anonymous> (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: []
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with node-gyp rebuild on native Windows using a binding.gyp that includes nested binding.gyp files. Start by tracing the output path handling in gyp/pylib/gyp/generator/msvs.py and gyp/pylib/gyp/MSVSNew.py, then inspect temporary-file creation in gyp/pylib/gyp/common.py. Done means the generated solution files can be written successfully without the missing-directory error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, python
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.