初次使用nodejs管理工具,npm去部署UI应用,不过一直卡在某一处异常,提示如下
build/binding.sln(1): Solution file error MSB5014: File format version is not recognized. MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.
gyp info spawn C:\Users\Administrator\.windows-build-tools\python27\python.exe gyp info spawn args [ 'E:\\java_workspace\\cloud-platform-ui\\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 '-G', gyp info spawn args 'msvs_version=2015', gyp info spawn args '-I', gyp info spawn args 'E:\\java_workspace\\cloud-platform-ui\\node_modules\\node-sass\\build\\config.gypi', gyp info spawn args '-I', gyp info spawn args 'E:\\java_workspace\\cloud-platform-ui\\node_modules\\node-gyp\\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\\Users\\Administrator\\.node-gyp\\10.15.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\\Administrator\\.node-gyp\\10.15.3', gyp info spawn args '-Dnode_gyp_dir=E:\\java_workspace\\cloud-platform-ui\\node_modules\\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\\Users\\Administrator\\.node-gyp\\10.15.3\\<(target_arch)\\node.lib', gyp info spawn args '-Dmodule_root_dir=E:\\java_workspace\\cloud-platform-ui\\node_modules\\node-sass', 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 'E:\\java_workspace\\cloud-platform-ui\\node_modules\\node-sass\\build', gyp info spawn args '-Goutput_dir=.' ] gyp verb command build [] gyp verb build type Release gyp verb architecture x64 gyp verb node dev dir C:\Users\Administrator\.node-gyp\10.15.3 gyp verb found first Solution file build/binding.sln gyp verb `which` succeeded for `msbuild` C:\Windows\Microsoft.NET\Framework\v2.0.50727\msbuild.EXE gyp info spawn msbuild gyp info spawn args [ 'build/binding.sln', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' ] build/binding.sln(1): Solution file error MSB5014: File format version is not recognized. MSBuild can only read solution files between versions 7.0 and 9.0, inclusive. gyp ERR! build error gyp ERR! stack Error: `msbuild` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (E:\java_workspace\cloud-platform-ui\node_modules\node-gyp\lib\build.js:258:23) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\java_workspace\\cloud-platform-ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd E:\java_workspace\cloud-platform-ui\node_modules\node-sass gyp ERR! node -v v10.15.3 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok Build failed with error code: 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.7.2 postinstall: `node scripts/build.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.7.2 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-05-26T12_36_30_316Z-debug.log
百度 研究半天没什么结果,仔细研究错误提示,可以看出跟msbuild相关,
首先按百度的解决方案1,
使用命令 npm install --global --production windows-build-tools 重新安装msbuild及python环境
然而并未解决。
再看错误,可能跟msbuild版本相关。因为本机只安装了vs2017。所以我尝试
npm install --global --production windows-build-tools --vs2015 指定版本去重装windows-build-tools。
然而无论是vs2017还是2015.也没解决。
继续,再分析其它提示,可能是跟node-sass相关。
干脆先清除一下node-sass相关文件,再重装。命令如下 :
npm uninstall node-sass
再重新安装
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
果然立马解决。
问题出自 http://www.kuizii.com
如果你们也遇到同样情况,希望对你有帮助。