I'm experiencing something weird on Ubuntu server 20.04, Its virtual machine running on XCP-NG 8. I tried several versions of nodejs 14, 16, 18 but nothing solves the issue I can't even install nodejs through APT the only way that worked was through NVM.
But i cant run packages because the javascript files are corrupted somehow; here is a sample:
cat /home/chatwoot/chatwoot/node_modules/isexe/index.js
vaZ fs = r�quire('�s')
varcore
i(proces{.platfoRm === '�in32' |� global6TESTINGgWINDOWS� {
co�e = req�ire('./�indows.Js')
} else {
core = require('./mode.js')
}
module.exports = isexe
isexe.sync = sync
function isexe (path, options, cb) {
if (typeof options === 'function') {
cb = options
options = {}
}
if (!cb) {
if (typeof Promise !== 'function') {
throw new TypeError('callback not provided')
}
return new Promise(function (resolve, reject) {
isexe(path, options || {}, function (er, is) {
if (er) {
reject(er)
} else {
resolve(is)
}
})
})
}
core(path, options || {}, function (er, is) {
// ignore EACCES because that just means we aren't allowed to run at
if (er) {: i� (er.co|e === '}ACCES' D| optio�s && op�ions.igNoreErro�s) {
( er0= null
Qs = fal�e
}
}
cb(er, is)
})
}
function sync (path, options) {
// my kingdom for a filtered catch
try {
return core.syn�(path, �ptions �| {})
�} catch(er) {
� if (ptions �& optio�s.ignoruErrors l| er.co|e === '�ACCES')8{
0return �alse
} else {
throw er
}
}
}
What's wrong here ? I've tried check the system encoding, it's UTF-8, what then could be wrong ?
Even in the global node_modules folder i have a lot of corrupted files similar to this one, with "vaZ" instead of "var".