PM2 couldn't start keystone - keystonejs

I cant start keystone on pm2. pm2 could not read "COOKIE_SECRET" from .env file.
I did set an environment variable in pm2 config file but I got the error again.
what shall I do ?

First thing you can check is the NODE_ENV variable setup as development or production, or the --env command line that you are using. Reference:
http://pm2.keymetrics.io/docs/usage/environment/
Kindly provide the error message encountered so that there are more information.
Usually one can use "pm2 start keystone.js" to start keystone without problem.

Related

environmental variable not being read (NPM)

So I have a project running with nodejs, and an env file using multiple variables. For some reason one of these does not seem to be working though.
Here the code should be printing out the port and namespace/ip of that the env file should have specified
`==> API is running on port ${process.env.API_PORT}`,
'\n',
`==> Send requests to http://${process.env.API_HOST}:${process.env.API_PORT}`
But for some reason it is only finding the host, as this is what the console actually outputs
==> API is running on port undefined
==> Send requests to http://127.0.0.1:undefined
Here is the .env file entries for these two variables
API_PORT=8080
API_HOST=127.0.0.1
The only guidance I have found so far was that I had to include require('dotenv').config(); but this did not resolve anything either.
What could be blocking the API_PORT variable?
UPDATE: So it seems when I host the server using npm, it works, but when I try to run code coverage over it using chai is when this error pops up (still npm run test).
Fast solution at the moment
in your package.json
Put your envs in your scripts
"scripts": {
"dev": "API_PORT=8080 API_HOST=127.0.0.1 node index.js",
"test": "your script here"
},
npm run dev should work fine.

while installing cypress through command :npm install cypress --save-dev getting error as The Cypress App could not be downloaded

while installing cypress through command :npm install cypress --save-dev getting error as The Cypress App could not be downloaded.
Error :
Finishing Installation
The Cypress App could not be downloaded.
Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
Otherwise, please check network connectivity and try again:
But please not I m not using any proxy and on my personal wifi.
plz suggest ,what can be done in this case.Thanks
It seems to be too many possible reasons for this issue in general but I managed to find a workaround to install Cypress from within a corporation with npm and without using sudo npm or turning off strict ssl.
The following worked for me per November 18th 2020 with Ubuntu 18.04 and npm 6.14.8:
I downloaded the zip file shown in https://docs.cypress.io/guides/getting-started/installing-cypress.html#Direct-download
I installed cypress as shown in https://docs.cypress.io/guides/getting-started/installing-cypress.html#Install-binary : CYPRESS_INSTALL_BINARY=~/Downloads/cypress.zip npm install cypress --save-dev
I could now run npx cypress open to start the gui (which will also generate the cypress.json file)
Possible Reasons for this issue:
U might be running the project with a proxy setting.
One of the reason could be you are behind the firewall.that may prohibit your network? Please follow the guidelines in Proxy Configuration if so(https://docs.cypress.io/guides/references/proxy-configuration.html#Set-a-proxy-on-Linux-or-macOS).
make sure you have right access to install the cypress.
if none of the above mentioned reasons try removing the biraries or node_modules and install again.

"--watch is not supported without git/hg" with cygwin jest and git

I would really appreciate help with this.
I have cygwin installed and set up to use the PATH from windows. This has been working great for a ton of node development, but I've recently run into an issue where when I run
yarn jest --watch
I get the following error:
--watch is not supported without git/hg, please use --watchAll
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have installed git and node in windows.
I have found a workaround of using the Command Prompt for running the tests, but would really like to be in one environment.
--watch works only for git repositories.
if you still have issue it is yarn issue npm gives the same error too. delete your node_modules folder, update yarn or npm to the latest version, then reinstall all the packages again.
After some consideration, I thought my workaround could be a valid answer to this question. Although, I would still like to get this working properly in Cygwin.
If you have node and git installed in windows then you can go into the Command Prompt and run yarn test --watch or npm run test -- --watch to accomplish the same thing.
I know it's been a long time. But i was facing the same issue and what resolved it for me was, to change the default terminal of whatever editor you're using to GIT command line. I was using VS Code and changing the terminal to GIT worked like a charm.
Make sure you're running it in a Git repo (initialised with git init). Otherwise it doesn't know how to get only the changed files.
If you don't want to run tests only on changed files, you can use --watchAll, which runs all the tests.
I also encountered this problem, the reason is that I use the mv command to move the project folder, however the command was not removed .git has points such as the beginning of the file
npm run test -- watchAll
Please use watchAll to serve it in a continue way. It will track your changes and re-run the test automatically.
git init
solves the problem, that way it knows the changed files

Nuxt deployment error: server resources are not available

To deploy our nuxt website in ssr mode we first build and unit test website in the bitbucket pipeline and if tests are green we copy build files from bitbucket servers to our production server and trigger start.
The problem is that Nuxt documentation says nothing about which exact files are required on the server.
currently we are using:
.nuxt/
server/
static/
nuxt.config.js
Sometimes after adding functionality to the website, deployed version throws an error:
Error: Server resources are not available!
At the same time local version works fine.
Also running production server locally on the project works.
Error kinda hints that some paths picked up incorrectly by nuxt.. but the directory structure is completely the same.
Any ideas why this happens and how to fix that?
If errors also mentions, Please check "file path"/.nuxt/dist/server existence.
Then on the terminal
cd .nuxt
check if 'dist' folder exists. If it does not exists,
go back and npm run build. this will generate the 'dist' folder for use.
If Still facing the issue, try,
npm install --save nuxt
npm install --save vue-server-renderer
Try adding: dev: process.env.NODE_ENV === 'DEV' to nuxt.config.js

How to resolve clipboard error while deploying vuejs app on ubuntu server

I am deploying a vuejs app on my server.we have EC2 instance with ubuntu 16.04,As of now I am just deploying my test project but when I go running serve command like sudo serve -s dist but it is throwing an error which is: ERROR: Cannot copy to clipboard: Command failed: xsel --clipboard --input
xsel: Can't open display: (null)
: Inappropriate ioctl for device
I don't know this error is caused by ubuntu or vuejs please help me solve it.
I have followed these cammands so far.
First installed vue cli using
npm install -g #vue/cli
Then created a hello world app using
vue create helloWorld
Now run serve command
npm run serve
It was showing me a message like:
App running at:
- Local: http://localhost:8081/
- Network: http://172.31.16.66:8081/
Now i have created a build to run an app on the production server
npm run build
So my build was created successfully
i run command to run the app on the live server
serve -s dist
And it is throwing an error which is not solving by me so far
WARNING: Checking for updates failed (use--debugto see full error)
ERROR: Cannot copy to clipboard: Command failed: xsel --clipboard --input
xsel: Can't open display: (null)
: Inappropriate ioctl for device
I am also attaching screenshot below.
As you can see, there is an X11 dependency with the serve module - which means you need an xserver(display) for it to work.
Alternatively, (highly recommended) you could use a high performance HTTP server like nginx, apache etc. instead.
All you need is to copy your dist folder to your instance, and point your virtual server block to the dist dir, and restart your HTTP server - BAM! you're up and running.
Cheers!
I had the same issue and I solved it by adding "-n" option to serve.
"-n, --no-clipboard Do not copy the local address to the clipboard"