getgridea / gridea

✍️ A static blog writing client (一个静态博客写作客户端)
https://open.gridea.dev
MIT License
9.97k stars 796 forks source link

gitclone项目后运行开发环境无法启动 #59

Closed jinwyp closed 5 years ago

jinwyp commented 5 years ago

git clone 项目后 npm install

然后启动开发环境 npm run electron:serve 后没有启动 electron的界面 没有启动background.js这个初始化入口文件.

命令行只有如下信息,


> gridea@0.8.0 electron:serve /Users/wangyp/Documents/github/gridea
> vue-cli-service electron:serve

 INFO  Starting development server...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
 98% after emitting CopyPlugin                                                      

 DONE  Compiled successfully in 27610ms                                                                                15:51:07

No type errors found
No lint errors found
Version: typescript 3.2.2, tslint 5.16.0
Time: 16466ms

  App running at:
  - Local:   http://localhost:8081/ 
  - Network: unavailable

nodejs 版本 v8.11.3

jinwyp commented 5 years ago

同时 运行 npm run electron:build 编译失败

npm run electron:build                

> gridea@0.8.0 electron:build /Users/wangyp/Documents/github/gridea
> vue-cli-service electron:build

 INFO  Bundling render process:

⠙  Building legacy bundle for production...Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
⠦  Building legacy bundle for production...

 DONE  Compiled successfully in 19271ms                                                                                16:04:37

  File                                      Size             Gzipped

  dist_electron/bundled/js/chunk-vendors    4042.54 KiB      811.34 KiB
  -legacy.b8b0e7eb.js
  dist_electron/bundled/js/app-legacy.bb    76.13 KiB        19.04 KiB
  59d656.js
  dist_electron/bundled/css/app.d7e9eb7e    450.98 KiB       54.99 KiB
  .css
  dist_electron/bundled/css/chunk-vendor    40.14 KiB        9.37 KiB
  s.96aef36d.css

  Images and other types of assets omitted.

⠙  Building for production...Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
⠴  Building for production...

 DONE  Compiled successfully in 20715ms                                                                                16:05:00

  File                                      Size             Gzipped

  dist/js/chunk-vendors.85fd906a.js         3980.94 KiB      789.43 KiB
  dist/js/app.35b7ca58.js                   68.74 KiB        18.23 KiB
  dist/default-files/themes/fly/style-ov    2.33 KiB         0.75 KiB
  erride.js
  dist/default-files/themes/notes/style-    1.56 KiB         0.52 KiB
  override.js
  dist/default-files/themes/simple/style    1.11 KiB         0.46 KiB
  -override.js
  dist/default-files/themes/paper/style-    0.62 KiB         0.29 KiB
  override.js
  dist/css/app.d7e9eb7e.css                 450.98 KiB       54.99 KiB
  dist/css/chunk-vendors.96aef36d.css       40.14 KiB        9.37 KiB

  Images and other types of assets omitted.

 DONE  Build complete. The dist directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

⠙  Bundling main process...

 WARNING  Compiled with 6 warnings                                                                                     16:05:48

 warning  in ./node_modules/less/lib/less-node/plugin-loader.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/less/lib/less-node/plugin-loader.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/less/lib/less-node/file-manager.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/less/lib/less-node/file-manager.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/ejs/lib/ejs.js

require.extensions is not supported by webpack. Use a loader instead.

 @ ./src/server/renderer.ts 7:0-22 303:18-21 352:18-21 389:18-21 420:14-17 482:22-25
 @ ./src/server/app.ts
 @ ./src/background.ts
 @ multi ./src/background.ts

 warning  in ./node_modules/ejs/lib/ejs.js

require.extensions is not supported by webpack. Use a loader instead.

 @ ./src/server/renderer.ts 7:0-22 303:18-21 352:18-21 389:18-21 420:14-17 482:22-25
 @ ./src/server/app.ts
 @ ./src/background.ts
 @ multi ./src/background.ts

  File                                   Size              Gzipped

  dist_electron/bundled/background.js    4180.90 KiB       821.13 KiB

  Images and other types of assets omitted.

 INFO  Building app with electron-builder:
  • electron-builder version=20.38.4
  • writing effective config file=dist_electron/builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=darwin arch=x64 electron=4.0.0 appOutDir=dist_electron/mac
  • asar using is disabled — it is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
 ERROR  Error: Application entry file "/Users/wangyp/Documents/github/gridea/dist_electron/mac/Gridea.app/Contents/Resources/app/background.ts" does not exist. Seems like a wrong configuration.
Error: Application entry file "/Users/wangyp/Documents/github/gridea/dist_electron/mac/Gridea.app/Contents/Resources/app/background.ts" does not exist. Seems like a wrong configuration.
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/platformPackager.ts:435:15
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at MacPackager.checkFileInPackage (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/platformPackager.ts:406:110)
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/platformPackager.ts:460:16
    at Generator.next (<anonymous>)
    at /Users/wangyp/Documents/github/gridea/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at MacPackager.sanityCheckPackage (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/platformPackager.ts:446:92)
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/platformPackager.ts:249:16
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at MacPackager.doPack (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/platformPackager.ts:167:165)
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/macPackager.ts:88:63
    at Generator.next (<anonymous>)
From previous event:
    at MacPackager.pack (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/macPackager.ts:80:95)
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/packager.ts:430:24
    at Generator.next (<anonymous>)
    at xfs.stat (/Users/wangyp/Documents/github/gridea/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /Users/wangyp/Documents/github/gridea/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/packager.ts:396:24)
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/packager.ts:366:57
    at Generator.next (<anonymous>)
    at /Users/wangyp/Documents/github/gridea/node_modules/graceful-fs/graceful-fs.js:111:16
    at /Users/wangyp/Documents/github/gridea/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/packager.ts:335:133)
    at /Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/packager.ts:331:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Packager.build (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/packager.ts:288:14)
    at build (/Users/wangyp/Documents/github/gridea/node_modules/app-builder-lib/src/index.ts:59:28)
    at Object.build (/Users/wangyp/Documents/github/gridea/node_modules/electron-builder/src/builder.ts:227:10)
    at buildApp (/Users/wangyp/Documents/github/gridea/node_modules/vue-cli-plugin-electron-builder/index.js:173:14)
    at bundle.run (/Users/wangyp/Documents/github/gridea/node_modules/vue-cli-plugin-electron-builder/index.js:155:15)
    at finalCallback (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:210:39)
    at hooks.done.callAsync.err (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:259:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/wangyp/Documents/github/gridea/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/wangyp/Documents/github/gridea/node_modules/tapable/lib/Hook.js:154:20)
    at emitRecords.err (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:257:22)
    at Compiler.emitRecords (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:371:39)
    at emitAssets.err (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:251:10)
    at hooks.afterEmit.callAsync.err (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:357:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/wangyp/Documents/github/gridea/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/wangyp/Documents/github/gridea/node_modules/tapable/lib/Hook.js:154:20)
    at asyncLib.forEach.err (/Users/wangyp/Documents/github/gridea/node_modules/webpack/lib/Compiler.js:354:27)
    at /Users/wangyp/Documents/github/gridea/node_modules/neo-async/async.js:2825:7
    at done (/Users/wangyp/Documents/github/gridea/node_modules/neo-async/async.js:2861:11)
    at /Users/wangyp/Documents/github/gridea/node_modules/neo-async/async.js:2813:7
    at /Users/wangyp/Documents/github/gridea/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gridea@0.8.0 electron:build: `vue-cli-service electron:build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the gridea@0.8.0 electron:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/wangyp/.npm/_logs/2019-04-18T08_06_09_848Z-debug.log
EryouHao commented 5 years ago

请使用最新版本 Node 尝试,或大于 11.0.0 的版本,稍后将记录在 README 中

jinwyp commented 5 years ago

我自己的electron 项目nodejs 8.11.3 用vue-cli-plugin-electron-builder 没有问题.

https://github.com/jinwyp/electron-learning

当然也有可能是和typescript 有关

nodejs 尽量用偶数版本是稳定的LTS版本.

Akimyou commented 5 years ago

我尝试了好多次,包括使用最新的 node 11, node 12 等,均无法正常启动 vue-cli-service electron:serve。 直到我发现了项目里的 yarn.lock,😭 最终使用 node 11 + yarn 成功启动了 建议:

如果需要我 PR 的,可以喊我,😜

EryouHao commented 5 years ago

已更新 README,并添加 engines,还是使用 yarn

感谢🙏

1166544 commented 5 years ago

require.extensions is not supported by webpack. Use a loader instead.

@ ./src/server/renderer.ts 5:0-22 327:18-21 377:12-15 424:12-15 457:14-17 521:16-19 @ ./src/server/app.ts @ ./src/background.ts @ multi ./src/background.ts

jerry-f commented 4 years ago

我也遇到了同样的问题,启动开发环境 npm run electron:serve 后没有启动 electron的界面;| 然后就一直停留在这个状态: Launching Electron... [10044:11568:0328/134707.023:ERROR:crash_report_database_win.cc(469)] failed to stat report (node:14224) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (node:14224) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. instance sftp deploy Main process runing... C:/Users/ff/Documents/Gridea Preview server is running on port : 4000 Preview server: Static dir change to C:/Users/youfei/Documents/Gridea/output instance sftp deploy

jerry-f commented 4 years ago

我尝试了好多次,包括使用最新的node 11,node 12等,均无法正常启动vue-cli-service electron:serve。 直到我发现了项目里的yarn.lock,😭 最终使用node 11 + yarn成功启动了 建议:

  • 添加.nvmrc明确节点的依赖版本
  • 抛弃yarn吧,或者修改下REDEME.md,把Development修改下

如果需要我PR的,可以喊我,😜

请问你是怎么解决的呢, 我也切换了不同版本的node 也是不行