Open dlinning-jockey opened 4 years ago
I more or less get the same error whenever I try to give a name to my app... for exemple:
npm start app.js // --> works like a charm
npm start app.js --name myApp // Crashes with Script not found
Well.... solved it by adding a trailing \ after app.js so:
npm start app.js\ --name myApp
Now works... hmmm.
@dlinning-jockey ,did you fixed it already?
@heavenkiller2018 I have not. This is still a standing bug.
Still not working.
This is still an issue. There is a workaround for it by giving npm file path in the script . #3657
We are already using pm2 in production. We are trying to change local development to Docker and its not working due to this script issue. I think this is supposed to be a feature which was implemented in #1317 but its failing now.
Can pm2 team take a look please.
Hello, Try the following steps: 1º Run one of the following yarn build or npm run build ("next build") 2º Create a file with an extension .json for example "deploy.json": { "apps" : [{ "name" : "Project_name", "script" : "./node_modules/next/dist/bin/next", "env":{ "PORT": "5454" } } ] } 3º Execute the following command pm2 start deploy.json
Hope it helps!
Hello, Try the following steps: 1º Run one of the following yarn build or npm run build ("next build") 2º Create a file with an extension .json for example "deploy.json": { "apps" : [{ "name" : "Project_name", "script" : "./node_modules/next/dist/bin/next", "env":{ "PORT": "5454" } } ] } 3º Execute the following command pm2 start deploy.json
Hope it helps!
I cant run app in production mode with this solution :)
Hello, Try the following steps: 1º Run one of the following yarn build or npm run build ("next build") 2º Create a file with an extension .json for example "deploy.json": { "apps" : [{ "name" : "Project_name", "script" : "./node_modules/next/dist/bin/next", "env":{ "PORT": "5454" } } ] } 3º Execute the following command pm2 start deploy.json
Hope it helps!
it works for me , thanks ! !
but there is still a question , I run 'pm2 start deploy.json', it runs the dev version. if I need to run the build(prod) version, need to edit './node_modules/next/dist/bin/next' file as (line 47) :
// const defaultCommand = 'dev';
const defaultCommand = 'start';
You can add start as args in deploy.json file :
"script": "./node_modules/next/dist/bin/next", "args": "start",
I don't think it is working.
scripts: { "start": "next build && next start -p 4000", .... }
deploy.json { "script": "node_module....../bin/next", "args": "start",
}
pm2 start deploy.json is not working but without "args": "start" working with the default port.
Hello, Try the following steps: 1º Run one of the following yarn build or npm run build ("next build") 2º Create a file with an extension .json for example "deploy.json": { "apps" : [{ "name" : "Project_name", "script" : "./node_modules/next/dist/bin/next", "env":{ "PORT": "5454" } } ] } 3º Execute the following command pm2 start deploy.json
Hope it helps!
It worked, thank you so much
Pra mim resolveu aplicando o comando abaixo. Fazendo a instalação do ts-node
npm install -g ts-node
still this issue is active
Had same issue
Turning command into pm2 start --name name script.js
worked for me
Hope it helps 👍
This has been an issue since 2020 and it's still not fixed!? This seems like a deal breaker because it made using pm2 a headache for the past couple of hours...
What's going wrong?
When trying to run a Next.js based site via PM2 through an npm script, the error above is thrown. See output below:
How could we reproduce this issue?
package.json
Command:
pm2 start npm --name "app" -- start
Supporting information
OS: Windows 10 NPM Path:
report.txt