Geoxor / Naoko

Naoko is my main Discord Bot
GNU General Public License v3.0
15 stars 16 forks source link

Can't install dependencies #122

Closed otiskujawa closed 2 years ago

otiskujawa commented 2 years ago

Ubuntu based distro after running "CXX=10 npm ci"

I have done everything that was written in README

2022-02-03T20_42_15_479Z-debug-0.log

N1kO23 commented 2 years ago

Hmm, interesting. You could try to remove node_modules directory and then run npm i instead of CXX=10 npm ci. Not sure if it will make any difference, but I think it is worth a shot.

otiskujawa commented 2 years ago

rm -r ./node_modules npm i 2022-02-05T14_13_01_473Z-debug-0.log

otiskujawa commented 2 years ago

I backed-up /usr/inclide/c++/11 and copied /usr/inclide/c++/10 to /usr/inclide/c++/11

┌──(otiskujawa@rimuru4)-[~/git/Shaii]
└─$ npm ci
npm WARN deprecated @types/file-type@10.9.1: This is a stub types definition. file-type provides its own type definitions, so you do not need this installed.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 557 packages, and audited 558 packages in 3m

47 packages are looking for funding
  run npm fund for details

13 vulnerabilities (8 moderate, 5 high)

To address all issues, run:
  npm audit fix

Run npm audit for details.

after trying npm audit fix npm audit fix --force

┌──(otiskujawa㉿rimuru4)-[~/git/Shaii]
└─$ npm audit fix

up to date, audited 558 packages in 2s

48 packages are looking for funding
  run `npm fund` for details

# npm audit report

ansi-regex  >2.1.1 <5.0.1
Severity: moderate
 Inefficient Regular Expression Complexity in chalk/ansi-regex - https://github.com/advisories/GHSA-93q8-gq69-wqmw
fix available via `npm audit fix`
node_modules/ansi-regex
  strip-ansi  4.0.0 - 5.2.0
  Depends on vulnerable versions of ansi-regex
  node_modules/strip-ansi
    string-width  2.1.0 - 4.1.0
    Depends on vulnerable versions of strip-ansi
    node_modules/string-width

is-svg  2.1.0 - 4.2.2
Severity: high
Regular Expression Denial of Service (ReDoS) - https://github.com/advisories/GHSA-7r28-3m3f-r2pr
ReDOS in IS-SVG - https://github.com/advisories/GHSA-r8j5-h5cx-65gg
fix available via `npm audit fix`
node_modules/is-svg
  get-svg-colors  *
  Depends on vulnerable versions of cheerio
  Depends on vulnerable versions of is-svg
  node_modules/get-svg-colors

nth-check  <2.0.1
Severity: moderate
Inefficient Regular Expression Complexity in nth-check - https://github.com/advisories/GHSA-rp65-9cf3-cjxr
fix available via `npm audit fix`
node_modules/nth-check
  css-select  <=3.1.0
  Depends on vulnerable versions of nth-check
  node_modules/css-select
    cheerio  0.19.0 - 1.0.0-rc.3
    Depends on vulnerable versions of css-select
    node_modules/cheerio
      get-svg-colors  *
      Depends on vulnerable versions of cheerio
      Depends on vulnerable versions of is-svg
      node_modules/get-svg-colors

8 vulnerabilities (6 moderate, 2 high)

To address all issues, run:
  npm audit fix

$ npm run dev (normal startup)

Error: Cannot find module '../assets/badWords.json'
Require stack:
- /home/otiskujawa/git/Shaii/src/moderation/isBadWord.shaii.ts
- /home/otiskujawa/git/Shaii/src/middleware/moderationMiddleware.shaii.ts
- /home/otiskujawa/git/Shaii/src/shaii/Shaii.shaii.ts
- /home/otiskujawa/git/Shaii/src/shaii.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/otiskujawa/git/Shaii/node_modules/@cspotcode/source-map-support/source-map-support.js:679:30)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/home/otiskujawa/git/Shaii/src/moderation/isBadWord.shaii.ts:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module.m._compile (/home/otiskujawa/git/Shaii/node_modules/ts-node/src/index.ts:1371:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .ts] (/home/otiskujawa/git/Shaii/node_modules/ts-node/src/index.ts:1374:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/otiskujawa/git/Shaii/src/moderation/isBadWord.shaii.ts',
    '/home/otiskujawa/git/Shaii/src/middleware/moderationMiddleware.shaii.ts',
    '/home/otiskujawa/git/Shaii/src/shaii/Shaii.shaii.ts',
    '/home/otiskujawa/git/Shaii/src/shaii.ts'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...
N1kO23 commented 2 years ago

Oh alright, the bot is working now. That error regarding to '../assets/badWords.json' is because the bot needs that file and it is not autocreated if it is missing. This can be easily fixed by creating the file manually and inside that file you have json array that contains all the bad/banned words.

otiskujawa commented 2 years ago

Ok I do not close because the problem still occurs for people who do not want to change system files

npm ci is using c++ 11 instead of 10 and CXX=10 is not working

Ubuntu based distro

qexat commented 2 years ago

Ok I do not close because the problem still occurs for people who do not want to change system files

npm ci is using c++ 11 instead of 10 and CXX=10 is not working

Ubuntu based distro

I think this is because of a mistake in the README. The correct command to do is:

CXX=g++-10 npm ci
qexat commented 2 years ago

Ok I found a better solution (doesn't require to have g++ which is, if I remember correctly, not installed on all systems by default):

CXX=gcc-10 npm i

CXX command prefix apparently does not accept implicit compiler naming, so specifying only the version is not enough and will not find it, making it switching to default version (gcc-11) which doesn't support Angle for an unknown reason (see issue #214 of libANGLE repository)

qexat commented 2 years ago

Issue solved by this commit. Thanks @N1kO23

otiskujawa commented 2 years ago

Nice