Open laichiaheng opened 8 years ago
gulp 要用 npm install -g gulp 忘記補 sorry
請問要怎麼執行呢?我安裝方式是進入資料夾,輸入 sudo npm install -g gulp,這樣就 OK 了嗎?
這是安裝gulp套件
安裝完gulp watch即可
跑出了這個訊息:/usr/bin/env: ‘node’: 沒有此一檔案或目錄
你還沒有安裝nodejs嗎?
已經有裝了
https://github.com/nodejs/node-v0.x-archive/issues/3911 這裡有一樣的問題 可以給個node版本嗎?
nodejs: 已安裝:4.2.6~dfsg-1ubuntu4 候選: 4.2.6~dfsg-1ubuntu4 版本列表: *\ 4.2.6~dfsg-1ubuntu4 500 500 http://tw.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages 100 /var/lib/dpkg/status
可以node -v
一下嗎?
第一次看過那版套件
ubuntu 有很多套件都叫nodejs
印象中要用到的是nodejs-legacy 但 ubuntu 套件的版本很舊
輸入 node -v 後他說我沒安裝 nodejs-legacy,所以我就安裝他 版本:v4.2.6
執行時他又要我安裝 gulp,所以又輸入了一次 sudo npm install gulp,然後執行 gulp watch 時跑出了以下的錯誤: module.js:328 throw err; ^
Error: Cannot find module 'electron-connect'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.
現在已經有裝gulp了 但其他套件還沒裝喔 要在run 一次 npm install
全部步驟
安裝nodejs (ubuntu sudo apt install nodejs-legacy)
安裝全域 gulp (npm install -g gulp
)
npm install
gulp watch
sudo npm install 完並執行 gulp watch 後跑出以下錯誤訊息: [20:39:28] Using gulpfile ~/hentai-master/gulpfile.js [20:39:28] Starting 'watch'... [20:39:28] Finished 'watch' after 2.64 ms [2016-05-12T12:39:28.053Z] [electron-connect] [server] started electron process: undefined [2016-05-12T12:39:28.053Z] [electron-connect] [server] created and listening on 30080 events.js:141 throw er; // Unhandled 'error' event ^
Error: spawn electron ENOENT at exports._errnoException (util.js:870:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32) at onErrorNT (internal/child_process.js:344:16) at nextTickCallbackWith2Args (node.js:441:9) at process._tickCallback (node.js:355:17) at Function.Module.runMain (module.js:444:11) at startup (node.js:136:18) at node.js:966:3
npm -g 是裝到全域 就是不在資料夾內也能呼叫
你安裝下electron-prebuilt
npm install --save-dev electron-prebuilt
看來我配置還有點問題呢~
安裝完後執行出現錯誤: [20:44:16] Using gulpfile ~/hentai-master/gulpfile.js [20:44:16] Starting 'watch'... [20:44:16] Finished 'watch' after 2.57 ms [2016-05-12T12:44:16.749Z] [electron-connect] [server] started electron process: 9265 [2016-05-12T12:44:16.749Z] [electron-connect] [server] created and listening on 30080 Error opening app The app provided is not a valid Electron app, please read the docs on how to write one: https://github.com/electron/electron/tree/v1.0.1/docs
Error: Cannot find module 'app'
https://github.com/brave/browser-laptop/issues/608 看來是因為你的nodejs版本有點舊
看來只好試試看方法二了 請問刪除只需要輸入 sudo npm remove 套件名稱 就好了嗎?
對 沒錯 方法一其實有解 因為我也是ubuntu
我輸入 sudo npm uninstall electron-prebuilt 後出現: npm WARN hentai@0.0.9 No repository field. npm WARN hentai@0.0.9 No license field.
那環境怎麼差這麼多!
hentai 版本號在0.0.9是因為我忙著改功能 沒改到版本號XD
所以其實已經刪除成功了嗎?
對 警告是因為我沒有把package.json 的資料填齊
其實非全域模組也可以直接進 node_module 下刪除
話說nodejs 這邊有更新方法喔
這個好像比較簡單 - 但我當時沒成功 https://by-example.org/install-node-js-6-on-ubuntu-16-04-xenial-xerus-lts/
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04
剛剛已經刪光光了,所以正在嘗試第二個方法XD 請問 resources\app 這個 app 資料夾是要自己創嗎?
對喔 其實告訴你個小祕密 我的客戶端其實就可以直接開發了XD 我沒打包 其實是可以直接修改的
可惜…我完全不會XD
執行 ./Electron\ API\ Demos 後跑出以下訊息:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'app'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.
這就跟node沒關西 因為這個的node已經編譯在electron 內了 放app/內的話直接執行electron 因該就可以了
這是我在 app 內放的檔案: $ ls ~/Electron\ API\ Demos-linux-x64/resources/app/ app.ico hentai.sublime-project index.html main.js README.md stylesheet gulpfile.js hentai.sublime-workspace js package.json release views
但是執行 Electron API Demos 會跑出剛剛的錯誤
https://drive.google.com/file/d/0B1NOJo1tOF_KUE95ak9ab1p3eGM/view?usp=sharing 你直接看我的執行檔研究下好了 基本上程式內部檔案是放在 electron/resources/app/ 懶人包就是方便
恩!你的就直接成功了 那個 hentai 執行檔是自己改名的嗎?
electron 有提供包裝器喔 我是用那個打包的 只是內部檔沒有打包起來而已 其實自己改名也是可以拉XD 不過在windows 上可能出現同一個執行檔的問題
您以後有打算包成 deb、rpm、snap 格式嗎?
rpm snap 可能electron 也沒推出執行檔 我也弄不太出來XD ( 官網好像有自行編譯辦法? 我是剛來 linux 的喔 還只是新手
找不到套件 gulp