RocketChat / Rocket.Chat.Electron

Official OSX, Windows, and Linux Desktop Clients for Rocket.Chat
https://rocket.chat/
MIT License
1.6k stars 703 forks source link

On fresh clone yarn throws error on desktop app #2919

Open milinddeore opened 3 months ago

milinddeore commented 3 months ago

Search before asking

Operating System

Operating System Version

Ubuntu 22.04

It happens on the web browser too?

No, it just happens on the Desktop app

Rocket.Chat Desktop App Version

latest

Rocket.Chat Server Version

latest

Describe the bug

I got following error on a fresh clone of desktop app:

ved@ved-Lenovo:~/Projects/desktop/Rocket.Chat.Electron$ yarn
/home/ved/Projects/desktop/Rocket.Chat.Electron/.yarn/releases/yarn-4.0.2.cjs:4
(()=>{var n_e=Object.create;var MT=Object.defineProperty;var i_e=Object.getOwnPropertyDescriptor;var s_e=Object.getOwnPropertyNames;var o_e=Object.getPrototypeOf,a_e=Object.prototype.hasOwnProperty;var Be=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Et=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kt=(t,e)=>{for(var r in e)MT(t,r,{get:e[r],enumerable:!0})},l_e=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of s_e(e))!a_e.call(t,a)&&a!==r&&MT(t,a,{get:()=>e[a],enumerable:!(o=i_e(e,a))||o.enumerable});return t};var $e=(t,e,r)=>(r=t!=null?n_e(o_e(t)):{},l_e(e||!t||!t.__esModule?MT(r,"default",{value:t,enumerable:!0}):r,t));var vi={};Kt(vi,{SAFE_TIME:()=>F7,S_IFDIR:()=>wD,S_IFLNK:()=>ID,S_IFMT:()=>Mu,S_IFREG:()=>Hw});var Mu,wD,Hw,ID,F7,T7=Et(()=>{Mu=61440,wD=16384,Hw=32768,ID=40960,F7=456789e3});var ar={};Kt(ar,{EBADF:()=>Io,EBUSY:()=>c_e,EEXIST:()=>g_e,EINVAL:()=>A_e,EISDIR:()=>h_e,ENOENT:()=>f_e,ENOSYS:()=>u_e,ENOTDIR:()=>p_e,ENOTEMPTY:()=>m_e,EOPNOTSUPP:()=>y_e,EROFS:()=>d_e,ERR_DIR_CLOSED:()=>OT});function Rl(t,e){return Object.assign(new Error(`${t}: ${e}`),{code:t})}function c_e(t){return Rl("EBUSY",t)}function u_e(t,e){return Rl("ENOSYS",`${t}, ${e}`)}function A_e(t){return Rl("EINVAL",`invalid argument, ${t}`)}function Io(t){return Rl("EBADF",`bad file descriptor, ${t}`)}function f_e(t){return Rl("ENOENT",`no such file or directory, ${t}`)}function p_e(t){return Rl("ENOTDIR",`not a directory, ${t}`)}function h_e(t){return Rl("EISDIR",`illegal operation on a directory, ${t}`)}function g_e(t){return Rl("EEXIST",`file already exists, ${t}`)}function d_e(t){return Rl("EROFS",`read-only filesystem, ${t}`)}function m_e(t){return Rl("ENOTEMPTY",`directory not empty, ${t}`)}function y_e(t){return Rl("EOPNOTSUPP",`operation not supported, ${t}`)}function OT(){return Rl("ERR_DIR_CLOSED","Directory handle was closed")}var BD=Et(()=>{});var Ea={};Kt(Ea,{BigIntStatsEntry:()=>ey,DEFAULT_MODE:()=>HT,DirEntry:()=>UT,StatEntry:()=>$m,areStatsEqual:()=>jT,clearStats:()=>vD,convertToBigIntStats:()=>C_e,makeDefaultStats:()=>R7,makeEmptyStats:()=>E_e});function R7(){return new $m}function E_e(){return vD(R7())}function vD(t){for(let e in t)if(Object.hasOwn(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):_T.types.isDate(r)&&(t[e]=new Date(0))}return t}function C_e(t){let e=new ey;for(let r in t)if(Object.hasOwn(t,r)){let o=t[r];typeof o=="number"?e[r]=BigInt(o):_T.types.isDate(o)&&(e[r]=new Date(o))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthtimeNs=e.birthtimeMs*BigInt(1e6),e}function jT(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||t.isFIFO()!==e.isFIFO()||t.isFile()!==e.isFile()||t.isSocket()!==e.isSocket()||t.isSymbolicLink()!==e.isSymbolicLink()||t.mode!==e.mode||t.mtimeMs!==e.mtimeMs||t.nlink!==e.nlink||t.rdev!==e.rdev||t.size!==e.size||t.uid!==e.uid)return!1;let r=t,o=e;return!(r.atimeNs!==o.atimeNs||r.mtimeNs!==o.mtimeNs||r.ctimeNs!==o.ctimeNs||r.birthtimeNs!==o.birthtimeNs)}var _T,HT,UT,$m,ey,qT=Et(()=>{_T=$e(Be("util")),HT=33188,UT=class{constructor(){this.name="";this.path="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},$m=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=HT;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},ey=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=BigInt(0);this.ino=BigInt(0);this.mode=BigInt(HT);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&BigInt(61440))===BigInt(16384)}isFIFO(){return!1}isFile(){return(this.mode&BigInt(61440))===BigInt(32768)}isSocket(){return!1}isSymbolicLink(){return(this.mode&BigInt(61440))===BigInt(40960)}}});function D_e(t){let e,r;if(e=t.match(B_e))t=e[1];else if(r=t.match(v_e))t=`\\\\${r[1]?".\\":""}${r[2]}`;else return t;return t.replace(/\//g,"\\")}function P_e(t){t=t.replace(/\\/g,"/");let e,r;return(e=t.match(w_e))?t=`/${e[1]}`:(r=t.match(I_e))&&(t=`/unc/${r[1]?".dot/":""}${r[2]}`),t}function DD(t,e){return t===ue?L7(e):GT(e)}var jw,Bt,dr,ue,K,N7,w_e,I_e,B_e,v_e,GT,L7,Ca=Et(()=>{jw=$e(Be("path")),Bt={root:"/",dot:".",parent:".."},dr={home:"~",nodeModules:"node_modules",manifest:"package.json",lockfile:"yarn.lock",virtual:"__virtual__",pnpJs:".pnp.js",pnpCjs:".pnp.cjs",pnpData:".pnp.data.json",pnpEsmLoader:".pnp.loader.mjs",rc:".yarnrc.yml",env:".env"},ue=Object.create(jw.default),K=Object.create(jw.default.posix);ue.cwd=()=>process.cwd();K.cwd=process.platform==="win32"?()=>GT(process.cwd()):process.cwd;process.platform==="win32"&&(K.resolve=(...t)=>t.length>0&&K.isAbsolute(t[0])?jw.default.posix.resolve(...t):jw.default.posix.resolve(K.cwd(),...t));N7=function(t,e,r){return e=t.normalize(e),r=t.normalize(r),e===r?".":(e.endsWith(t.sep)||(e=e+t.sep),r.startsWith(e)?r.slice(e.length):null)};ue.contains=(t,e)=>N7(ue,t,e);K.contains=(t,e)=>N7(K,t,e);w_e=/^([a-zA-Z]:.*)$/,I_e=/^\/\/(\.\/)?(.*)$/,B_e=/^\/([a-zA-Z]:.*)$/,v_e=/^\/unc\/(\.dot\/)?(.*)$/;GT=process.platform==="win32"?P_e:t=>t,L7=process.platform==="win32"?D_e:t=>t;ue.fromPortablePath=L7;ue.toPortablePath=GT});async function PD(t,e){let r="0123456789abcdef";await t.mkdirPromise(e.indexPath,{recursive:!0});let o=[];for(let a of r)for(let n of r)o.push(t.mkdirPromise(t.pathUtils.join(e.indexPath,`${a}${n}`),{recursive:!0}));return await Promise.all(o),e.indexPath}async function M7(t,e,r,o,a){let n=t.pathUtils.normalize(e),u=r.pathUtils.normalize(o),A=[],p=[],{atime:h,mtime:E}=a.stableTime?{atime:Lg,mtime:Lg}:await r.lstatPromise(u);await t.mkdirpPromise(t.pathUtils.dirname(e),{utimes:[h,E]}),await YT(A,p,t,n,r,u,{...a,didParentExist:!0});for(let I of A)await I();await Promise.all(p.map(I=>I()))}async function YT(t,e,r,o,a,n,u){let A=u.didParentExist?await O7(r,o):null,p=await a.lstatPromise(n),{atime:h,mtime:E}=u.stableTime?{atime:Lg,mtime:Lg}:p,I;switch(!0){case p.isDirectory():I=await x_e(t,e,r,o,A,a,n,p,u);break;case p.isFile():I=await Q_e(t,e,r,o,A,a,n,p,u);break;case p.isSymbolicLink():I=await F_e(t,e,r,o,A,a,n,p,u);break;default:throw new Error(`Unsupported file type (${p.mode})`)}return(u.linkStrategy?.type!=="HardlinkFromIndex"||!p.isFile())&&((I||A?.mtime?.getTime()!==E.getTime()||A?.atime?.getTime()!==h.getTime())&&(e.push(()=>r.lutimesPromise(o,h,E)),I=!0),(A===null||(A.mode&511)!==(p.mode&511))&&(e.push(()=>r.chmodPromise(o,p.mode&511)),I=!0)),I}async function O7(t,e){try{return await t.lstatPromise(e)}catch{return null}}async function x_e(t,e,r,o,a,n,u,A,p){if(a!==null&&!a.isDirectory())if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;let h=!1;a===null&&(t.push(async()=>{try{await r.mkdirPromise(o,{mode:A.mode})}catch(v){if(v.code!=="EEXIST")throw v}}),h=!0);let E=await n.readdirPromise(u),I=p.didParentExist&&!a?{...p,didParentExist:!1}:p;if(p.stableSort)for(let v of E.sort())await YT(t,e,r,r.pathUtils.join(o,v),n,n.pathUtils.join(u,v),I)&&(h=!0);else(await Promise.all(E.map(async b=>{await YT(t,e,r,r.pathUtils.join(o,b),n,n.pathUtils.join(u,b),I)}))).some(b=>b)&&(h=!0);return h}async function b_e(t,e,r,o,a,n,u,A,p,h){let E=await n.checksumFilePromise(u,{algorithm:"sha1"}),I=r.pathUtils.join(h.indexPath,E.slice(0,2),`${E}.dat`),v;(te=>(te[te.Lock=0]="Lock",te[te.Rename=1]="Rename"))(v||={});let b=1,C=await O7(r,I);if(a){let U=C&&a.dev===C.dev&&a.ino===C.ino,J=C?.mtimeMs!==S_e;if(U&&J&&h.autoRepair&&(b=0,C=null),!U)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1}let T=!C&&b===1?`${I}.${Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0")}`:null,L=!1;return t.push(async()=>{if(!C&&(b===0&&await r.lockPromise(I,async()=>{let U=await n.readFilePromise(u);await r.writeFilePromise(I,U)}),b===1&&T)){let U=await n.readFilePromise(u);await r.writeFilePromise(T,U);try{await r.linkPromise(T,I)}catch(J){if(J.code==="EEXIST")L=!0,await r.unlinkPromise(T);else throw J}}a||await r.linkPromise(I,o)}),e.push(async()=>{C||await r.lutimesPromise(I,Lg,Lg),T&&!L&&await r.unlinkPromise(T)}),!1}async function k_e(t,e,r,o,a,n,u,A,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;return t.push(async()=>{let h=await n.readFilePromise(u);await r.writeFilePromise(o,h)}),!0}async function Q_e(t,e,r,o,a,n,u,A,p){return p.linkStrategy?.type==="HardlinkFromIndex"?b_e(t,e,r,o,a,n,u,A,p,p.linkStrategy):k_e(t,e,r,o,a,n,u,A,p)}async function F_e(t,e,r,o,a,n,u,A,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;return t.push(async()=>{await r.symlinkPromise(DD(r.pathUtils,await n.readlinkPromise(u)),o)}),!0}var Lg,S_e,WT=Et(()=>{Ca();Lg=new Date(456789e3*1e3),S_e=Lg.getTime()});function SD(t,e,r,o){let a=()=>{let n=r.shift();if(typeof n>"u")return null;let u=t.pathUtils.join(e,n);return Object.assign(t.statSync(u),{name:n,path:void 0})};return new qw(e,a,o)}var qw,U7=Et(()=>{BD();qw=class{constructor(e,r,o={}){this.path=e;this.nextDirent=r;this.opts=o;this.closed=!1}throwIfClosed(){if(this.closed)throw OT()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.read())!==null;)yield e}finally{await this.close()}}read(e){let r=this.readSync();return typeof e<"u"?e(null,r):Promise.resolve(r)}readSync(){return this.throwIfClosed(),this.nextDirent()}close(e){return this.closeSync(),typeof e<"u"?e(null):Promise.resolve()}closeSync(){this.throwIfClosed(),this.opts.onClose?.(),this.closed=!0}}});function _7(t,e){if(t!==e)throw new Error(`Invalid StatWatcher status: expected '${e}', got '${t}'`)}var H7,ty,j7=Et(()=>{H7=Be("events");qT();ty=class extends H7.EventEmitter{constructor(r,o,{bigint:a=!1}={}){super();this.status="ready";this.changeListeners=new Map;this.startTimeout=null;this.fakeFs=r,this.path=o,this.bigint=a,this.lastStats=this.stat()}static create(r,o,a){let n=new ty(r,o,a);return n.start(),n}start(){_7(this.status,"ready"),this.status="running",this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.fakeFs.existsSync(this.path)||this.emit("change",this.lastStats,this.lastStats)},3)}stop(){_7(this.status,"running"),this.status="stopped",this.startTimeout!==null&&(clearTimeout(this.startTimeout),this.startTimeout=null),this.emit("stop")}stat(){try{return this.fakeFs.statSync(this.path,{bigint:this.bigint})}catch{let o=this.bigint?new ey:new $m;return vD(o)}}makeInterval(r){let o=setInterval(()=>{let a=this.stat(),n=this.lastStats;jT(a,n)||(this.lastStats=a,this.emit("change",a,n))},r.interval);return r.persistent?o:o.unref()}registerChangeListener(r,o){this.addListener("change",r),this.changeListeners.set(r,this.makeInterval(o))}unregisterChangeListener(r){this.removeListener("change",r);let o=this.changeListeners.get(r);typeof o<"u"&&clearInterval(o),this.changeListeners.delete(r)}unregisterAllChangeListeners(){for(let r of this.changeListeners.keys())this.unregisterChangeListener(r)}hasChangeListeners(){return this.changeListeners.size>0}ref(){for(let r of this.changeListeners.values())r.ref();return this}unref(){for(let r of this.changeListeners.values())r.unref();return this}}});function ry(t,e,r,o){let a,n,u,A;switch(typeof r){case"function":a=!1,n=!0,u=5007,A=r;break;default:({bigint:a=!1,persistent:n=!0,interval:u=5007}=r),A=o;break}let p=xD.get(t);typeof p>"u"&&xD.set(t,p=new Map);let h=p.get(e);return typeof h>"u"&&(h=ty.create(t,e,{bigint:a}),p.set(e,h)),h.registerChangeListener(A,{persistent:n,interval:u}),h}function Mg(t,e,r){let o=xD.get(t);if(typeof o>"u")return;let a=o.get(e);typeof a>"u"||(typeof r>"u"?a.unregisterAllChangeListeners():a.unregisterChangeListener(r),a.hasChangeListeners()||(a.stop(),o.delete(e)))}function Og(t){let e=xD.get(t);if(!(typeof e>"u"))for(let r of e.keys())Mg(t,r)}var xD,VT=Et(()=>{j7();xD=new WeakMap});function T_e(t){let e=t.match(/\r?\n/g);if(e===null)return G7.EOL;let r=e.filter(a=>a===`\r

SyntaxError: missing ) after argument list
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47

How to Reproduce

  1. Following are my build tools and their respective versions:
    ved@ved-Lenovo:~/Projects/desktop$ npm --version
    ^[[A6.14.18
    ved@ved-Lenovo:~/Projects/desktop$ nvm --version
    0.39.7
    ved@ved-Lenovo:~/Projects/desktop$ yarn --version
    1.22.22
    ved@ved-Lenovo:~/Projects/desktop$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 20.04.6 LTS
    Release:    20.04
    Codename:   focal
  2. Clone the repo: git clone https://github.com/RocketChat/Rocket.Chat.Electron.git && cd Rocket.Chat.Electron.git
  3. yarn <<<<<<<<< This is when i get the above error.

Describe your Expected behavior

I have pasted the logs above.

Anything else

With the same tool chain (yarn) i could build server successfully. Logs can be found above.

Are you willing to submit a code contribution?

jeanfbrito commented 3 months ago

what is the node version?