Getting 'OSError: [Errno 2] No such file or directory:' during `node-gyp` compilation of module in `npm install`
Getting 'OSError: [Errno 2] No such file or directory:' during `node-gyp` compilation of module in `npm install`
npm install
在下面抛出错误。我的应用程序依赖的模块之一是原生 Node.js 模块,re2
(它依赖于 node-gyp
,这意味着它是在安装时编译的):
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py", line 2025, in GenerateOutput
version=msvs_version)
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py", line 213, in __init__
self.Write()
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py", line 340, in Write
f.close()
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py", line 396, in close
os.unlink(self.tmp_path)
OSError: [Errno 2] No such file or directory: '/cygdrive/c/git/ecom/git-repo-inspector/node_modules/@my-app/some-mod/node_modules/re2/C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\re2\build/binding.sln.gyp.7gDS9t.tmp'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (c:\Users\<Me>\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\Program Files\nodejs\node.exe" "c:\Users\<Me>\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\re2
gyp ERR! node -v v11.9.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok
npm verb lifecycle re2@1.8.4~install: unsafe-perm in lifecycle true
npm verb lifecycle re2@1.8.4~install: PATH: C:\Users\<Me>\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\re2\node_modules\.bin;C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\.bin;C:\git\ecom\git-repo-inspector\node_modules\.bin;C:\cygwin64\usr\local\bin;C:\cygwin64\bin;C:\Program Files (x86)\Python36-3
我的 npm
配置为 Python 2.7:
python = "c:\Python27\python.exe"
npm 版本:
$ npm -v
6.9.0
node-gyp 版本:
$ node-gyp --version
v4.0.0
我已经按照 here.
安装了 Visual Studio Profession 2017 的 Desktop development with C++
更新:我找到了解决方法,read the details here
npm install
在下面抛出错误。我的应用程序依赖的模块之一是原生 Node.js 模块,re2
(它依赖于 node-gyp
,这意味着它是在安装时编译的):
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py", line 2025, in GenerateOutput
version=msvs_version)
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py", line 213, in __init__
self.Write()
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py", line 340, in Write
f.close()
File "/cygdrive/c/Users/<Me>/AppData/Roaming/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py", line 396, in close
os.unlink(self.tmp_path)
OSError: [Errno 2] No such file or directory: '/cygdrive/c/git/ecom/git-repo-inspector/node_modules/@my-app/some-mod/node_modules/re2/C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\re2\build/binding.sln.gyp.7gDS9t.tmp'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (c:\Users\<Me>\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\Program Files\nodejs\node.exe" "c:\Users\<Me>\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\re2
gyp ERR! node -v v11.9.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok
npm verb lifecycle re2@1.8.4~install: unsafe-perm in lifecycle true
npm verb lifecycle re2@1.8.4~install: PATH: C:\Users\<Me>\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\re2\node_modules\.bin;C:\git\ecom\git-repo-inspector\node_modules\@my-app\some-mod\node_modules\.bin;C:\git\ecom\git-repo-inspector\node_modules\.bin;C:\cygwin64\usr\local\bin;C:\cygwin64\bin;C:\Program Files (x86)\Python36-3
我的 npm
配置为 Python 2.7:
python = "c:\Python27\python.exe"
npm 版本:
$ npm -v
6.9.0
node-gyp 版本:
$ node-gyp --version
v4.0.0
我已经按照 here.
安装了 Visual Studio Profession 2017 的Desktop development with C++
更新:我找到了解决方法,read the details here