Pm2 start npm-- start reported an error!

the content of 1.package.json is as follows:

{
    "dev": "node server",
    "start": "cross-env NODE_ENV=production node server",
    "build": "node build/build.js",
    "build:dll": "webpack --config build/webpack.dll.conf.js"
}

error when starting server using pm2 start npm-- start :

C:\PROGRAM FILES\NODEJS\NPM.CMD:1
0|admin-we | (function (exports, require, module, __filename, __dirname) { :: Created by npm, please don"t edit manually.
0|admin-we |                                                               ^
0|admin-we |
0|admin-we | SyntaxError: Unexpected token :
0|admin-we |     at createScript (vm.js:80:10)
0|admin-we |     at Object.runInThisContext (vm.js:139:10)
0|admin-we |     at Module._compile (module.js:616:28)
0|admin-we |     at Object.Module._extensions..js (module.js:663:10)
0|admin-we |     at Module.load (module.js:565:32)
0|admin-we |     at tryModuleLoad (module.js:505:12)
0|admin-we |     at Function.Module._load (module.js:497:3)
0|admin-we |     at Object.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:83:21)
0|admin-we |     at Module._compile (module.js:652:30)
0|admin-we |     at Object.Module._extensions..js (module.js:663:10)

2. There is no problem running npm start directly, only after using pm2.

Dec.03,2021

pm2 start "C:\ Program Files\ nodejs\ node_modules\ npm\ bin\ npm-cli.js"-- name "xxx"-- run start

the official issue mentioned

https://github.com/Unitech/pm2/issues/3657


is not pm2 start pm2.json?
launch script


npm i node-cmd --save-dev

then, create a new server.js (with an arbitrary name) in the project root directory that contains the startup command as follows:

var cmd=require('node-cmd'); 
cmd.run('npm start');

Last

pm2 start server.js

do I have the same problem? Has the blogger solved it? Find a solution


has the landlord problem been solved? I am also the same problem, looking for a solution.


does the landlord have a solution


LZ? I also encountered this problem, and found that this error was reported. It's the same problem as this (an open issues): https://github.com/Unitech/pm.


execute in the project directory: pm2 start. / node_modules/nuxt/bin/nuxt-start


pm2 start "C:Program Filesnodejsnode_modulesnpmbinnpm-cli.js"-- name "your project name"-- run start

https://github.com/Unitech/pm.

Menu