blogar
For this use only node v19.0.0 else you will not be able to start the app from systemd startup script
copied the whole certification folder from url24.top/certification with .next folder
and this started working with systemd service file
To install npm, run the following command after configuring npm:
npm install npm@5.6.0
root@server:/home/cloudvariation.in/public_html# node -v
v16.18.0
root@server:/home/cloudvariation.in/public_html# npm install
npm ERR! code 1
npm ERR! path /home/cloudvariation.in/public_html/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c — (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Are you trying to install as a root or sudo user?
npm ERR! sharp: – For npm <= v6, try again with the “–unsafe-perm” flag
npm ERR! sharp: – For npm >= v8, the user must own the directory “npm install” is run in
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: EACCES: permission denied, mkdir ‘/root/.npm’
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-10-18T08_07_04_058Z-debug-0.log
sudo npm install --unsafe-perm=true --allow-root
also fresh file unzipped and no file permission change works fine
got it working thanks a lot for you support
/home/cloudvariation.in/public_html/blogar
i was moving the files from blogar to outside and that was causing issue you need to execute commands from inside blogar folder only
to run on port 3001
vi node_modules/next/dist/cli/next-start.js
edited here
to start application
npm run start
node node_modules/next/dist/cli/next-start.js
from inside blogar folder
npm install pm2 -g
pm2 start node_modules/next/dist/cli/next-start.js
I am trying to run from inside a folder certification url24.top/certification
- Go to the next.config.js file and follow the instructions given in the screenshot finally save the file. The screenshot attached
to start the application automatically
vi /lib/systemd/system/blogarcert.service
[Unit]
Description=app
After=multi-user.target
[Service]
Type=idle
ExecStart=npm start
WorkingDirectory=/home/urlshortener.top/public_html/public/certification
User=root
[Install]
WantedBy=multi-user.target
sudo chmod 644 /lib/systemd/system/blogarcert.service
sudo systemctl daemon-reload sudo systemctl enable blogarcert.servicesudo systemctl start blogarcert.servicesudo systemctl status blogarcert.service
How can the default node version be set using NVM?
nvm alias default 6.11.5
if you want it pegged to that specific version.
You can also do nvm alias default 16
.
Either way, you'll want to upgrade to the latest version of nvm
(v0.33.11 as of this writing)
$ nvm alias default 16.14.2
# nvm set default node.js version 16.14.2
$ node -v
# v16.14.2
root@server:/home/cloudvariation.in/public_html/blogar# nvm alias default 16.18.0
default -> 16.18.0 (-> v16.18.0)
nvm use default
This will set the default to be the most current version of node
nvm alias default node
and then you'll need to run
nvm use default
or exit and open a new tab
Failed to load plugin '@next/next' declared in '.eslintrc.js
its due to different versions of nodejs
I installed nvm and updated nodejs from version 12.22 to to version 18.6.0 then deployed it for the other users (gitlab-runner)
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; cp -r $n/{bin,lib,share} /usr/local
- I removed the node_modules folder with
rm -r node_modules
an reinstalled withnpm install
Comments
Post a Comment