From ccb23d0faf3a7c73c4b5ac5ef5f5219c3b69893d Mon Sep 17 00:00:00 2001 From: Gao Peng Date: Mon, 9 Mar 2020 19:54:58 +0800 Subject: [PATCH] #4463 FAQ for Maven compilation failure with error like python2 not found (#4473) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #4463 FAQ for Maven compilation failure with error like python2 not found * #4463 FAQ for Maven compilation failure with error like python2 not found * Update maven-compile-npm-failure.md * Update docs/en/FAQ/README.md Co-Authored-By: 吴晟 Wu Sheng * Update docs/en/FAQ/maven-compile-npm-failure.md Co-authored-by: kezhenxu94 Co-authored-by: 吴晟 Wu Sheng --- docs/en/FAQ/README.md | 1 + docs/en/FAQ/maven-compile-npm-failure.md | 62 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 docs/en/FAQ/maven-compile-npm-failure.md diff --git a/docs/en/FAQ/README.md b/docs/en/FAQ/README.md index ea5db1ee78..340b2f67f4 100644 --- a/docs/en/FAQ/README.md +++ b/docs/en/FAQ/README.md @@ -7,6 +7,7 @@ These are known and common FAQs. We welcome you to contribute yours. ## Compiling * [Protoc plugin fails in maven build](Protoc-Plugin-Fails-When-Build.md) * [Required items could not be found, when import project into Eclipse](Import-Project-Eclipse-RequireItems-Exception.md) +* [Maven compilation failure with `python2 not found` error](maven-compile-npm-failure.md) ## Runtime * [Why metrics indexes(ElasticSearch) in Hour and Day precisions stop update after upgrade to 7.x?](Hour-Day-Metrics-Stopping.md) diff --git a/docs/en/FAQ/maven-compile-npm-failure.md b/docs/en/FAQ/maven-compile-npm-failure.md new file mode 100644 index 0000000000..b9194ba5c7 --- /dev/null +++ b/docs/en/FAQ/maven-compile-npm-failure.md @@ -0,0 +1,62 @@ +### Problem: Maven compilation failure with error like `Error: not found: python2` +When you compile the project via maven, it failed at module `apm-webapp` and the following error occured. + +Pay attention to key words such as `node-sass` and `Error: not found: python2`. + +``` +[INFO] > node-sass@4.11.0 postinstall C:\XXX\skywalking\skywalking-ui\node_modules\node-sass +[INFO] > node scripts/build.js + +[ERROR] gyp verb check python checking for Python executable "python2" in the PATH +[ERROR] gyp verb `which` failed Error: not found: python2 +[ERROR] gyp verb `which` failed at getNotFoundError (C:\XXX\skywalking\skywalking-ui\node_modules\which\which.js:13:12) +[ERROR] gyp verb `which` failed at F (C:\XXX\skywalking\skywalking-ui\node_modules\which\which.js:68:19) +[ERROR] gyp verb `which` failed at E (C:\XXX\skywalking\skywalking-ui\node_modules\which\which.js:80:29) +[ERROR] gyp verb `which` failed at C:\XXX\skywalking\skywalking-ui\node_modules\which\which.js:89:16 +[ERROR] gyp verb `which` failed at C:\XXX\skywalking\skywalking-ui\node_modules\isexe\index.js:42:5 +[ERROR] gyp verb `which` failed at C:\XXX\skywalking\skywalking-ui\node_modules\isexe\windows.js:36:5 +[ERROR] gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:152:21) + +[ERROR] gyp verb `which` failed code: 'ENOENT' } +[ERROR] gyp verb check python checking for Python executable "python" in the PATH +[ERROR] gyp verb `which` succeeded python C:\Users\XXX\AppData\Local\Programs\Python\Python37\python.EXE +[ERROR] gyp ERR! configure error +[ERROR] gyp ERR! stack Error: Command failed: C:\Users\XXX\AppData\Local\Programs\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; +[ERROR] gyp ERR! stack File "", line 1 +[ERROR] gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; +[ERROR] gyp ERR! stack ^ +[ERROR] gyp ERR! stack SyntaxError: invalid syntax +[ERROR] gyp ERR! stack +[ERROR] gyp ERR! stack at ChildProcess.exithandler (child_process.js:275:12) +[ERROR] gyp ERR! stack at emitTwo (events.js:126:13) +[ERROR] gyp ERR! stack at ChildProcess.emit (events.js:214:7) +[ERROR] gyp ERR! stack at maybeClose (internal/child_process.js:925:16) +[ERROR] gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) +[ERROR] gyp ERR! System Windows_NT 10.0.17134 +...... +[INFO] server-starter-es7 ................................. SUCCESS [ 11.657 s] +[INFO] apm-webapp ......................................... FAILURE [ 25.857 s] +[INFO] apache-skywalking-apm .............................. SKIPPED +[INFO] apache-skywalking-apm-es7 .......................... SKIPPED +``` + +### Reason + +It has nothing to do with SkyWalking. +According to https://github.com/sass/node-sass/issues/1176, if you live in countries where requesting resources from `GitHub` and `npmjs.org` is very slowly, some precompiled binaries for dependency `node-sass` will fail to be downloaded during `npm install`, then npm will try to compile them itself. That's why `python2` is needed. + +### Resolve +#### 1. Use mirror. Such as in China, please edit `skywalking\apm-webapp\pom.xml` +Find +``` + + install --registry=https://registry.npmjs.org/ + +``` +Replace it with +``` + + install --registry=https://registry.npm.taobao.org/ --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ + +``` +#### 2. Get an enough powerful VPN -- GitLab