thedevs-network / kutt

Free Modern URL Shortener.
https://kutt.it
MIT License
8.43k stars 1.1k forks source link

npm install issues on Plesk #700

Open g1lby opened 1 year ago

g1lby commented 1 year ago

Hi, I'm having trouble installing kutt on my plesk server (running on rocky green obsidian) inside a customer account. I previously installed the npm manager extension, the docker extension along with a redis-latest container and set up a git repository clone of this one, but with the adjusted .env file.

When I log into the server after pulling the repo via ssh, I'm getting errors with the npm install command, which I tried to bypass via --force, but this gives me the following output, /var/www/vhosts/example1.com/.npm/_logs/2023-07-20T12_43_45_213Z-debug-0.log:

[gnx@hosting example2.com]$ npm install --force
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-use-form-state@0.13.2
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   22 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from react-use-form-state@0.13.2
npm WARN node_modules/react-use-form-state
npm WARN   react-use-form-state@"^0.13.2" from the root project
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^16.8.0" from react-use-form-state@0.13.2
npm WARN   node_modules/react-use-form-state
npm WARN     react-use-form-state@"^0.13.2" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-use-form-state@0.13.2
npm WARN Found: react-dom@17.0.2
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from the root project
npm WARN   9 more (easy-peasy, next, react-resize-detector, react-smooth, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^16.8.0" from react-use-form-state@0.13.2
npm WARN node_modules/react-use-form-state
npm WARN   react-use-form-state@"^0.13.2" from the root project
npm WARN
npm WARN Conflicting peer dependency: react-dom@16.14.0
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"^16.8.0" from react-use-form-state@0.13.2
npm WARN   node_modules/react-use-form-state
npm WARN     react-use-form-state@"^0.13.2" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: use-media@1.4.0
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   22 more (@emotion/core, @emotion/styled, @emotion/styled-base, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.1" from use-media@1.4.0
npm WARN node_modules/use-media
npm WARN   use-media@"^1.4.0" from the root project
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^16.8.1" from use-media@1.4.0
npm WARN   node_modules/use-media
npm WARN     use-media@"^1.4.0" from the root project
npm WARN deprecated @types/nanoid@3.0.0: This is a stub types definition. nanoid provides its own type definitions, so you do not need this installed.
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
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 ERR! code 1
npm ERR! path /var/www/vhosts/example1.com/example2.com/node_modules/re2
npm ERR! command failed
npm ERR! command sh -c install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || npm run rebuild
npm ERR! Trying https://github.com/uhop/node-re2/releases/download/1.17.8/linux-x64-115.br ...
npm ERR! Trying https://github.com/uhop/node-re2/releases/download/1.17.8/linux-x64-115.gz ...
npm ERR! Building locally ...
npm ERR!
npm ERR! > re2@1.17.8 rebuild
npm ERR! > node-gyp rebuild
npm ERR!
npm ERR! make: Entering directory '/var/www/vhosts/example1.com/example2.com/node_modules/re2/build'
npm ERR!   CXX(target) Release/obj.target/re2/lib/addon.o
npm ERR! make: Leaving directory '/var/www/vhosts/example1.com/example2.com/node_modules/re2/build'
npm ERR!
npm ERR! > re2@1.17.8 rebuild
npm ERR! > node-gyp rebuild
npm ERR!
npm ERR! make: Entering directory '/var/www/vhosts/example1.com/example2.com/node_modules/re2/build'
npm ERR!   CXX(target) Release/obj.target/re2/lib/addon.o
npm ERR! make: Leaving directory '/var/www/vhosts/example1.com/example2.com/node_modules/re2/build'
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@20.4.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/example2.com/node_modules/re2/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/.cache/node-gyp/20.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/var/www/vhosts/example1.com/.cache/node-gyp/20.4.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/var/www/vhosts/example1.com/.cache/node-gyp/20.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/var/www/vhosts/example1.com/example2.com/node_modules/re2',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: g++: Command not found
npm ERR! make: *** [re2.target.mk:172: Release/obj.target/re2/lib/addon.o] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:512:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 4.18.0-372.19.1.el8_6.x86_64
npm ERR! gyp ERR! command "/opt/plesk/node/20/bin/node" "/var/www/vhosts/example1.com/example2.com/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /var/www/vhosts/example1.com/example2.com/node_modules/re2
npm ERR! gyp ERR! node -v v20.4.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok
npm ERR! node:internal/process/promises:289
npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
npm ERR!             ^
npm ERR!
npm ERR! [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "1".] {
npm ERR!   code: 'ERR_UNHANDLED_REJECTION'
npm ERR! }
npm ERR!
npm ERR! Node.js v20.4.0
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@20.4.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/example2.com/node_modules/re2/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/www/vhosts/example1.com/.cache/node-gyp/20.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/var/www/vhosts/example1.com/.cache/node-gyp/20.4.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/var/www/vhosts/example1.com/.cache/node-gyp/20.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/var/www/vhosts/example1.com/example2.com/node_modules/re2',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: g++: Command not found
npm ERR! make: *** [re2.target.mk:172: Release/obj.target/re2/lib/addon.o] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/var/www/vhosts/example1.com/example2.com/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:512:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 4.18.0-372.19.1.el8_6.x86_64
npm ERR! gyp ERR! command "/opt/plesk/node/20/bin/node" "/var/www/vhosts/example1.com/example2.com/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /var/www/vhosts/example1.com/example2.com/node_modules/re2
npm ERR! gyp ERR! node -v v20.4.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok

I didn't want to deploy kutt via docker, because I wanted to use the postgres integrated in plesk. Does anyone has a suggestion what to do next?

furchtlos76 commented 11 months ago

Did you get it to work on plesk? I would like to do the same and add this great product to one of my domains.

fb1970 commented 10 months ago

I have similar issue issue on Heroku. As far as I understand things react-use-form-state@0.13.2 wants a react version < 17.0.0 ("peer react@"^16.8.0" from react-use-form-state@0.13.2") and e.g. the next module wants a react version > 17.0.2 which can never be resolved.

davidgs commented 10 months ago

I have managed to fix this ...

/srv/kutt # npx npm-check-updates -u That will upgrade all the packages in package.json to the most recent versions. Then, the current overrides for the react-use-form is wrong. It can't deal with the * value I replaced it with:

"react-use-form-state": {
      "react": "^18.2.0",
      "react-dom": "^18.2.0"
    },

(after the npx npx-check-updates command) and it now builds just fine.

rizwanmustafa commented 3 months ago

I am getting the same error as well

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-use-form-state@0.13.2
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!   peer react@">=16.3.0" from @emotion/core@10.3.1
npm ERR!   node_modules/@emotion/core
npm ERR!     peer @emotion/core@"^10.0.27" from @emotion/styled@10.3.0
npm ERR!     node_modules/@emotion/styled
npm ERR!       @emotion/styled@"^10.0.0" from reflexbox@4.0.6
npm ERR!       node_modules/rebass/node_modules/reflexbox
npm ERR!         reflexbox@"^4.0.6" from rebass@4.0.7
npm ERR!         node_modules/rebass
npm ERR!     peer @emotion/core@"^10.0.28" from @emotion/styled-base@10.3.0
npm ERR!     node_modules/@emotion/styled-base
npm ERR!       @emotion/styled-base@"^10.3.0" from @emotion/styled@10.3.0
npm ERR!       node_modules/@emotion/styled
npm ERR!         @emotion/styled@"^10.0.0" from reflexbox@4.0.6
npm ERR!         node_modules/rebass/node_modules/reflexbox
npm ERR!     1 more (reflexbox)
npm ERR!   21 more (@emotion/styled, @emotion/styled-base, easy-peasy, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from react-use-form-state@0.13.2
npm ERR! node_modules/react-use-form-state
npm ERR!   react-use-form-state@"^0.13.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from react-use-form-state@0.13.2
npm ERR!   node_modules/react-use-form-state
npm ERR!     react-use-form-state@"^0.13.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/rizwan/.npm/_logs/2024-07-08T16_20_36_501Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/rizwan/.npm/_logs/2024-07-08T16_20_36_501Z-debug-0.log