Issue: after generating and starting my new jHipster API in the browser I got the following issue:
Uncaught ReferenceError: angular is not defined
Before the generation I installed the latest:
- node.js
- yo
- bower
- grunt-cli according to the guidelines
During the generation I got the following warning and errors:
I'm all done. Running npm install & bower install for you to install the required dependencies. If this fails, try running the command yourself.
[email protected] install K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\bufferutil node-gyp rebuild K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Users\korban\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14) gyp ERR! stack at C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\bufferutil gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:[email protected] [email protected] install: node-gyp rebuild npm WARN install:[email protected] Exit status 1
[email protected] install K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\utf-8-validate node-gyp rebuild K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Users\korban\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14) gyp ERR! stack at C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\korban\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd K:\work\HP_AIC_WebAdmin_Customization\workspace\aicwebadminapi\node_modules\utf-8-validate gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:[email protected] [email protected] install: node-gyp rebuild npm WARN install:[email protected] Exit status 1 npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: [email protected] bower angular-aria#1.4.8 ENOGIT git is not installed or not in the PATH Running "ngconstant:dev" (ngconstant) task Creating module aicwebadminapiApp at src/main/webapp/scripts/app/app.constants.js...OK
Running "wiredep:app" (wiredep) task Warning: Error: Cannot find where you keep your Bower packages. Use --force to continue.
Aborted due to warnings.
I made long investigations about the:
- node_gyp vs Python issue
- "cannot find bower packages' issue
- "angular is not defined" issue
but I didn't find a working solution.
Note: mvn clean install and mvn spring-boot:run are running successfully!
If you have any useful thoughts to share about this I would really appreaciate it!
Thank you for your help in advance!
@@@@@@@@@@@@@@@@@@@@@@@@
Final solution
Fix for node_gyp vs Python issue:
- Downgrade to: Node.js 4.2.3 LTS and npm 2.14.7,
- install Python 2.7.10 and Visual Studio Express (www.microsoft.com/en-gb/download/details.aspx?id=44914) as well (see node-gyp dependencies:github.com/nodejs/node-gyp#installation)
Fix for "cannot find bower packages' issue and "angular is not defined" issue:
Note: First of all use rff-doctor(github.com/rakuten-frontend/rff-doctor) to verify system configuration for using Yeoman, Grunt and Bower etc. It will show you what is missing and how can you purchase it/them.
What was missing in my case:
- installing Git(git-scm.com/downloads) and setting it for using https instead of git with the following command:
git config --global url."https://".insteadOf git:// - installing Ruby(www.ruby-lang.org/) and adding it to the PATH
- installing Sass using gem:
gem install sassand addig it to the PATH