I'm trying to install pm2
on a Raspberry pi. I did it with sudo npm install -g pm2
:
pi@raspberrypi:~ $ sudo npm install -g pm2
/usr/bin/pm2 -> /usr/lib/node_modules/pm2/bin/pm2
/usr/bin/pm2-dev -> /usr/lib/node_modules/pm2/bin/pm2-dev
/usr/bin/pm2-docker -> /usr/lib/node_modules/pm2/bin/pm2-docker
/usr/bin/pm2-runtime -> /usr/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.1 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
+ pm2@4.1.2
updated 3 packages in 16.284s
However, when I run pm2, I have the following error:
pi@raspberrypi:~ $ pm2 start script.sh
/usr/lib/node_modules/pm2/node_modules/has-flag/index.js:1
24 �ubelet.goz0t4] node "rispberrypy-1# not found
^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/lib/node_modules/pm2/node_modules/supports-color/index.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
In this example I ran pm2 start
but I have the same error with any of the pm2
commands
Do you know what is this error and how can I solve it?
Thanks
pm2 requires that you start a node.js script. In your provided example you are trying to execute script.sh
with pm2. Try putting the pm2 command in the script and just execute the script:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.