我正在尝试从源代码构建JHipster Registry,因为我正在关注Matt Raible's tutorial。
但是我收到退出代码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中的该目录,然后运行yarn
或yarn install
。
我是JHipster的新手。我不确定问题是sass还是python2或其他问题。我正在寻找有关该问题以及如何解决问题的详细信息?
节点版本:8.3.0
Power Shell版本:5.1.16251.0
操作系统 - &gt;
版本:Windows 10企业内幕预览
版本:1703
OS Build:16251.1002
[据我所知,
i)使用fsevents警告是因为我使用的是Windows x-64,而fsevents主要用于Mac来监控文件系统。这是对的吗?
ii)注册表是否使用Angular 2作为前端设计? (即使您可以使用JHispter构建Angular 4应用程序)
iii)构建新包时,node_sass会抱怨它找不到python.exe文件,但我检查了文件夹,但该文件存在。我也在路径中有python3.5.4。
在后续步骤中,它是否正在寻找python2,因为它没有找到python3?如果JHipster是一个SpirngBoot(后端)+ Angular(前端)应用程序,那么python将在哪里使用?我们也可以编写温和的python脚本吗?]
答案 0 :(得分:0)
i)纠正你可以忽略这个警告
ii)注册表是由JHipster生成的应用程序(您可以在.yo-rc.json
文件中查看其选项)并使用角度4作为其UI
iii)python仅用于构建节点而不是app运行时,这里的问题是node-sass无法构建,这是一个环境问题:
现在,坏消息是你在Windows上; nodejs的最佳平台是Linux和macOS,Matt Raible在macOS上,所以他没有遇到你所有的问题。即使修复python和nodejs版本node-gyp也可能无法构建本机模块。如果发生这种情况,你几乎没有其他选择:
答案 1 :(得分:0)
我只是将NodeJS降级到6.x,事情开始变得很有效。所以,请尝试降级它并使用:yarn。重新编译。