windows 上的 Jhipster uml 安装问题:NPM 在 msbuild.exe 上失败,退出代码为 1

Jhipster uml installation issue on windows : NPM fails on msbuild.exe with exit code 1

您好,我一直在尝试使用 yarn 和 npm 工具安装 jhipster-uml。但最终会出错。早些时候不得不将版本 Python 从 3.6 降到 2.7 以满足 npm 需求。另外,根据一些 post 使用 npm 安装了 windows visual studio。 问题仍然存在。请在下面找到错误。让我知道是否有人遇到过类似情况并已解决?

我的机器是 windows 10 运行 英特尔 i5 核心 8 GB 内存。

如果我需要更多详细信息,请告诉我。

更新:

  1. 尝试了 site 中的步骤并没有多大帮助。在这里我不能 安装 npm install bcrypt --save faild 并出现同样的错误

  2. 也如issue中指出post here已安装windows 构建工具和 python。 npm 安装 --global --production windows-build-tools 但安装成功。

For yarn global add jhipster-uml

C:\Windows>yarn global add jhipster-uml
yarn global v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] ⠁ deasync: Build failed
[-/1] ⠁ waiting...
[-/1] ⠁ waiting...
[-/1] ⠁ waiting...
error C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments:
Directory: C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync
Output:
C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@9.3.0 | win32 | x64
gyp info spawn C:\Users\ameya.shetti\.windows-build-tools\python27\python.exe
gyp info spawn args [ 'D:\Program Files\nodejs\node_modules\npm\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=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync\build\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\Users\ameya.shetti\.node-gyp\9.3.0\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\ameya.shetti\.node-gyp\9.3.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\Users\ameya.shetti\.node-gyp\9.3.0\<(target_arch)\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync',
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   'C:\Users\my.pc\AppData\Local\Yarn\config\global\node_modules\deasync\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync\build\deasync.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:159:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ameya.shetti\AppData\Local\Yarn\config\global\node_modules\deasync
gyp ERR! node -v v9.3.0

For npm install -g jhipster-uml

C:\Windows>npm install -g jhipster-uml
C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\jhipster-uml\node_modules\deasync>if not defined npm_config_node_gyp (node "C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\jhipster-uml\node_modules\deasync\build\deasync.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:159:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "D:\Program Files\nodejs\node.exe" "C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ameya.shetti\AppData\Roaming\npm\node_modules\jhipster-uml\node_modules\deasync
gyp ERR! node -v v9.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! deasync@0.1.9 install: `node ./build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the deasync@0.1.9 install 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\ameya.shetti\AppData\Roaming\npm-cache\_logs17-12-20T04_45_39_859Z-debug.log

终于解决了

我实际上停了上面的问题,当我遇到同样的问题时,我正试图为 jhipster 微服务安装 jhipster-registry-master。因此重试了之前不起作用的所有步骤。这次解决了

所以我对解决上述问题的观察是

1. npm install --global --production windows-build-tools 使用命令提示符(ADMIN) [右击开始菜单(win 10)找到列表中的选项。]

这会安装 python 2.7 和 vc studio 2015。即使您安装 python 并在环境变量中设置路径,npm 也不会检测到,直到您执行此步骤。

2. 使用相同的管理员权限 shell 到 运行 jhipster-registry-master 上的 yarn 命令并成功执行。使用相同的功率 shell 使用 yarn global add jhipster-uml

安装 jhipster-uml

有效

结论: 要使 jhipster-uml 工作,它需要 ms visual studio 依赖项和对 运行 某些 .cp 文件的管理权限,使用 windows构建工具。