0

我正在尝试通过从源代码构建JHipster Registry来启动它,为此我正在关注Matt Raible 的教程

但是我收到退出代码 1 的错误,以下是生成的堆栈跟踪。

yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.1: The platform "win32" is incompatible with this module.
info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "angular2-cookie@1.2.6" has incorrect peer dependency "@angular/common@^2.0.0".
warning "angular2-cookie@1.2.6" has incorrect peer dependency "@angular/core@^2.0.0".
warning "ng2-translate@4.2.0" has incorrect peer dependency "@angular/core@^2.0.0".
warning "ng2-translate@4.2.0" has incorrect peer dependency "@angular/http@^2.0.0".
[4/4] Building fresh packages...
[1/4] ⢀ node-sass: could not find "C:\Users\Srikar\AppData\Local\Programs\Python\Python35\python.EXE". checking
[-/4] ⢀ waiting...
[3/4] ⠠ phantomjs-prebuilt: Receiving...
[-/4] ⠠ waiting...
error D:\JHipster\jhipster-microservices-example\registry\node_modules\node-

sass: Command failed.
Exit code: 1
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c node scripts/build.js
Directory: D:\JHipster\jhipster-microservices-example\registry\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe D:\JHipster\jhipster-microservices-example\registry\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'D:\\JHipster\\jhipster-microservices-example\\registry\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.6.0
gyp info using node@8.3.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\JHipster\jhipster-microservices-example\registry\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\JHipster\jhipster-microservices-example\registry\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\JHipster\jhipster-microservices-example\registry\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\JHipster\jhipster-microservices-example\registry\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\JHipster\jhipster-microservices-example\registry\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21) code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\Srikar\AppData\Local\Programs\Python\Python35\python.EXE
gyp verb check python version `C:\Users\Srikar\AppData\Local\Programs\Python\Python35\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.5.4\r\n"
gyp verb could not find "C:\Users\Srikar\AppData\Local\Programs\Python\Python35\python.EXE". checking python launcher
gyp verb could not find "C:\Users\Srikar\AppData\Local\Programs\Python\Python35\python.EXE". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Srikar\AppData\Local\Programs\Python\Python35\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (D:\JHipster\jhipster-microservices-example\registry\node_modules\node-gyp\lib\configure.js:482:19)
gyp ERR! stack     at PythonFinder.<anonymous> (D:\JHipster\jhipster-microservices-example\registry\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at D:\JHipster\jhipster-microservices-example\registry\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.16251
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\JHipster\\jhipster-microservices-example\\registry\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\JHipster\jhipster-microservices-example\registry\node_modules\node-sass
gyp ERR! node -v v8.3.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

执行的步骤:

1) 从 Github 下载JHipster Registry并解压。

2) 在 Windows PowerShell 中导航到该目录并运行yarnor yarn install

我是 JHipster 的新手。我不确定问题出在 sass 还是 python2 或其他问题上。我正在寻找有关该问题的详细信息以及如何解决它?

节点版本:8.3.0

电源外壳版本:5.1.16251.0

操作系统->

版本:Windows 10 Enterprise Insider Preview

版本:1703

操作系统版本:16251.1002

【据我所知,

i) fsevents 的警告是因为我使用的是 Windows x-64,而 fsevents 主要用于 Mac 来监控文件系统。那是对的吗?

ii) 注册中心是否使用 Angular 2 进行前端设计?(即使您可以使用 JHister 构建 Angular 4 应用程序)

iii) 在构建新包时,node_sass 抱怨找不到 python.exe 文件,但我检查了文件夹但文件存在。我的路径中也有 python3.5.4。

在后面的步骤中,是不是因为没找到python3才找python2?如果 JHipster 是 SpirngBoot(后端)+ Angular(前端)应用程序,那么 python 将在哪里使用?我们也可以编写温和的 python 脚本吗?]

4

2 回答 2

0

我只是将 NodeJS 降级到 6.x,然后事情就开始好转了。所以,请尝试降级它并使用重新编译:yarn。

于 2018-01-31T00:47:39.323 回答
0

i) 更正您可以忽略此警告

ii) 注册表是由 JHipster 生成的应用程序(您可以在.yo-rc.json文件中看到它的选项),并在其 UI 中使用 Angular 4

iii)python仅用于节点构建而不是应用程序运行时,这里的问题是无法构建的node-sass,这是一个环境问题:

  • node-gyp 需要 python 2.x 来构建像 node-sass 这样的原生模块,并且你有 python 3.x,请重新安装
  • JHipster 建议使用 Node 当前 6.x 的 LTS 版本,您使用的是当前最新的 8.x,请考虑重新安装。

现在,坏消息是您使用的是 Windows。nodejs 的最佳平台是 Linux 和 macOS,Matt Raible 在 macOS 上,所以他没有遇到你所有的问题。即使修复了您的 python 和 nodejs 版本,node-gyp 也可能无法构建本机模块。如果发生这种情况,您几乎没有其他选择:

于 2017-08-29T11:14:30.937 回答