在“ npm install”模块的“ node-gyp”编译期间,出现“ OSError:[Errno 2]没有此类文件或目录:”

时间:2019-06-18 01:48:31

标签: node.js windows cygwin npm-install gyp

import requests req = requests.Request('GET', 'http://www.example.com') url = req.url print (url) 在下面引发错误。我的应用程序依赖的模块之一是原生Node.js模块npm install(它依赖于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 使用Python 2.7进行了配置:

npm

npm版本:

python = "c:\\Python27\\python.exe"

node-gyp版本:

$ npm -v
6.9.0

我已经按照here安装了Visual Studio Profession 2017的$ node-gyp --version v4.0.0

更新:我找到了一种解决方法,read the details here

1 个答案:

答案 0 :(得分:0)

阅读有关如何解决问题的详细信息here,或者至少找到适合我需要的工作。