Windows 上的 Jhipster uml 安装问题:NPM 在 msbuild.exe 上失败,退出代码为 1
Posted
技术标签:
【中文标题】Windows 上的 Jhipster uml 安装问题:NPM 在 msbuild.exe 上失败,退出代码为 1【英文标题】:Jhipster uml installation issue on windows : NPM fails on msbuild.exe with exit code 1 【发布时间】:2018-06-02 14:27:04 【问题描述】:您好,我一直在尝试使用 yarn 和 npm 工具安装 jhipster-uml。但以错误告终。早些时候不得不将 Python 版本从 3.6 降到 2.7 以满足 npm 的需求。另外根据一些帖子,使用 npm 安装了 windows visual studio。 问题仍然存在。请在下面找到错误。让我知道有人遇到过类似情况并解决了吗?
我的机器是运行在 Intel i5 core 8 gb ram 上的 Windows 10。
如果我需要更多详细信息,请告诉我。
更新:
从site 尝试的步骤并没有太大帮助。在这里我不能 install npm install bcrypt --save 失败并出现同样的错误
也正如问题帖子here 中指出的那样,已安装 Windows 构建工具和python。 npm install --global --production windows-build-tools 但安装成功。
对于纱线全局添加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\14.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\14.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
对于 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\14.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\_logs\2017-12-20T04_45_39_859Z-debug.log
【问题讨论】:
【参考方案1】:终于解决了
当我遇到同样的问题时,我实际上停了上面的问题,并试图为 jhipster 微服务安装jhipster-registry-master。所以重试了所有以前不起作用的步骤。这次解决了
所以我对解决上述问题的观察是
1. npm install --global --production windows-build-tools
使用命令提示符 (ADMIN) [右键单击开始菜单 (win 10) 以在列表中找到选项。]
这将安装 python 2.7 和 vc studio 2015。即使您安装了 python 并在环境变量中设置路径,npm 也不会检测到,直到您执行此步骤。
2. 使用相同的 admin power shell 在 jhipster-registry-master 上运行 yarn 命令并成功执行。使用相同的 power shell 安装 jhipster-uml 使用 yarn global add jhipster-uml
成功了
结论:要让 jhipster-uml 工作,它需要 ms Visual Studio 依赖和管理员权限才能使用 windows 构建工具运行一些 .cp 文件。
【讨论】:
以上是关于Windows 上的 Jhipster uml 安装问题:NPM 在 msbuild.exe 上失败,退出代码为 1的主要内容,如果未能解决你的问题,请参考以下文章