jhipster-registry,学习第二步+配置过程的问题及解决办法

 

从github下载下来的jhipster-registry,访问http://localhost:8761会发现会空白页,但是网页的title显示正常。

1、执行git clone https://github.com/jhipster/jhipster-registry.git

2、cd jhipster-registry-master

3、./mvnw或者mvnw运行起来这个项目,会自动build项目,启动成功如图

ctrl + c 停止运行

4、安装python,python下载地址:www.python.org/downloads/

5、运行yarn构建项目前端部分,依次输入执行

yarn
yarn add node-sass
yarn start

这里还可能会遇到一个插曲,使用yarn 安装,node-sass安装失败

error [email protected]: The engine "node" is incompatible with this module. Expected
version ">=4 <=9".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this comm
and.

使用npm就要面对尝试各种方式都无法下载的困境啊,狗血

再次尝试安装。npm install node-sass。还是失败……

gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\yan6\AppData\Local\Programs\Pytho
n\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];

gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:288:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:249:5)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\Dev\\jhipster-regist
ry-master\\jhipster-registry\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild
" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsa
ss_library="
gyp ERR! cwd E:\Dev\jhipster-registry-master\jhipster-registry\node_modules\node
-sass
gyp ERR! node -v v10.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\yan6\AppData\Roaming\npm-cache\_logs\2018-08-16T00_33_14_8
84Z-debug.log

第三次尝试,设置淘宝镜像

>npm set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/

再次运行npm install node-sass

还是失败,报错跟上面一样。

第四次尝试,安装cnpm,全局的淘宝镜像来试一下。node-sass实在是太难安装了

npm install -g cnpm --registry=https://registry.npm.taobao.org

别失望,就算是安装这个cnpm,也装了我三次才安装上。没有别的途径,多尝试几次。

再次尝试npm install node-sass,报错跟上面一样!

尝试cnpm install --save-dev node-sass,提示让我们删除包目录node_modules再尝试

Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit cod
e 1
Error: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit cod
e 1
    at ChildProcess.proc.on.code (C:\Users\yan6\AppData\Roaming\npm\node_modules
\cnpm\node_modules\runscript\index.js:74:21)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
npminstall version: 3.11.0
npminstall args: C:\Program Files\nodejs\node.exe C:\Users\yan6\AppData\Roaming\
npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions
--china --userconfig=C:\Users\yan6\.cnpmrc --disturl=https://npm.taobao.org/mirr
ors/node --registry=https://registry.npm.taobao.org --save-dev node-sass

还是安装不上。。。

搞不好是yarn版本问题?升级最新版本再尝试用yarn来安装

error [email protected]: The engine "node" is incompatible with this module. Expected
version ">=4 <=9".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this
command.

也是失败的。

再仔细看看提示,说是PATH没有配置Python的运行路径?安装包安装时不是勾选了吗?我太过相信Python的安装包了,环境变量还是要自己添加。

然后,又开始报另外一个错了……

gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\yan6\AppData\Local\Programs\Python\Py
thon37-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\yan6\AppData\Local\Programs\Pytho
n\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];

最终还是老外有办法。使用命令忽略yarn的版本检查设置

yarn config set ignore-engines true

再次更新yarn add node-sass还是报错,但是别放弃了,多跑几次就成功了!总结出,安装node -sass有时成功有时失败,不用质疑方法不对,就是国外服务器给你较大的概率失败。。。

可以继续了。

yarn add node-sass 是为了安装依赖的node-sass包,在安装yarn时,如果node-sass没有安装成功,前端构建会报错。

yarn start 会自动启动这个项目并打开浏览器页面,如图

出现的这个页面是无法登录的,ctrl +c 停止运行

再次使用./mvnw或mvnw启动项目,访问http://localhost:8761/

 

如图,问题解决。也可以打包发布了

# 检出
git clone https://github.com/jhipster/jhipster-registry.git
# 编译启动
mvn clean package
java -jar target/jhipster-registry-2.5.7.war

猜你喜欢

转载自blog.csdn.net/ztz87/article/details/81734916