【发布时间】:2026-01-31 15:00:01
【问题描述】:
问题: 在浏览器中生成并启动我的新 jHipster API 后,我遇到了以下问题:
Uncaught ReferenceError: angular is not defined
之前我安装了最新的一代:
- node.js
- 哟
- 凉亭
- 咕噜声-cli 根据guidelines
在生成期间,我收到以下警告和错误:
我已经完成了。运行 npm install & bower install 供您安装 所需的依赖项。如果失败,请尝试运行命令 自己。
bufferutil@1.2.1 安装 K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\bufferutil 节点gyp重建 K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\bufferutil>if 未定义 npm_config_node_gyp (节点 “C:\Users\korban\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js” 重建)否则(节点重建)gyp ERR!配置错误gyp ERR!堆 错误:找不到 Python 可执行文件“python”,您可以设置 PYTHON 环境变量。吉普错误!堆栈失败NoPython (C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14) 吉普错误!堆栈在 C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11 吉普错误!堆栈在 FSReqWrap.oncomplete (fs.js:82:15) gyp ERR!系统 Windows_NT 6.1.7601 gyp 错误!命令“C:\程序 文件\nodejs\node.exe" “C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “重建” gyp ERR! cwd K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\bufferutil 吉普错误!节点 -v v5.3.0 gyp 错误!节点-gyp -v v3.2.1 gyp 错误!不好 npm WARN 安装:bufferutil@1.2.1 bufferutil@1.2.1 安装:node-gyp 重建 npm WARN install:bufferutil@1.2.1 退出状态 1
utf-8-validate@1.2.1 安装 K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\utf-8-validate 节点gyp重建 K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\utf-8-validate>如果未定义 npm_config_node_gyp(节点 “C:\Users\korban\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js” 重建)否则(节点重建)gyp ERR!配置错误gyp ERR!堆 错误:找不到 Python 可执行文件“python”,您可以设置 PYTHON 环境变量。吉普错误!堆栈失败NoPython (C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14) 吉普错误!堆栈在 C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11 吉普错误!堆栈在 FSReqWrap.oncomplete (fs.js:82:15) gyp ERR!系统 Windows_NT 6.1.7601 gyp 错误!命令“C:\程序 文件\nodejs\node.exe" “C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “重建” gyp ERR! cwd K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\utf-8-validate 吉普错误!节点 -v v5.3.0 gyp 错误!节点-gyp -v v3.2.1 gyp 错误!不好 npm WARN 安装:utf-8-validate@1.2.1 utf-8-validate@1.2.1 安装: node-gyp rebuild npm WARN install:utf-8-validate@1.2.1 Exit status 1 npm WARN 可选跳过失败的可选依赖项 /chokidar/fsevents: npm WARN notsup 不兼容你的操作 系统或架构:fsevents@1.0.6 bower angular-aria#1.4.8 ENOGIT git 未安装或不在运行“ngconstant:dev”的 PATH 中 (ngconstant) 任务创建模块 aicwebadminapiApp 在 src/main/webapp/scripts/app/app.constants.js...OK
运行“wiredep:app”(wiredep)任务警告:错误:找不到位置 你保留你的 Bower 包裹。使用 --force 继续。
由于警告而中止。
我对以下方面进行了长时间调查:
- node_gyp 与 Python 问题
- “找不到 Bower 包的问题
- “未定义角度”问题
但我没有找到可行的解决方案。
注意: mvn clean install 和 mvn spring-boot:run 运行成功!
如果您对此有任何有用的想法要分享,我真的很感激!
提前感谢您的帮助!
@@@@@@@@@@@@@@@@@@@@@@@@@
最终解决方案
修复 node_gyp 与 Python 的问题:
- 降级到:Node.js 4.2.3 LTS 和 npm 2.14.7,
- 同时安装 Python 2.7.10 和 Visual Studio Express (www.microsoft.com/en-gb/download/details.aspx?id=44914) (请参阅 node-gyp 依赖项:github.com/nodejs/node-gyp#installation)
修复“找不到凉亭包”问题和“未定义角度”问题:
注意: 首先使用 rff-doctor(github.com/rakuten-frontend/rff-doctor) 来验证使用 Yeoman、Grunt 和 Bower 的系统配置等等。它会告诉你缺少什么以及如何购买它/它们。
在我的案例中缺少什么:
- 安装 Git(git-scm.com/downloads) 并使用以下命令将其设置为使用 https 而不是 git:
git config --global url."https://".insteadOf git:// - 安装 Ruby(www.ruby-lang.org/) 并将其添加到 PATH
- 使用 gem 安装 Sass:
gem install sass并将其添加到 PATH
【问题讨论】:
标签: python angularjs node.js bower jhipster