Модератор: april22
не активируется и не обновляется pm2
Приветствую вас, коллеги.
помогите пожалуйста решить проблему
Дано: RaspberryPi 3B+ + Raspbx дистр на ней
проблема с модулем pm2
при попытке его обновить и задействовать — ошибка:
- Код: выделить все
Installing pm2
Installing/Updating Required Libraries. This may take a while...Found npm-cache v0.7.0 Running installation.. ...................
Finished updating libraries!There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
Error(s) installing pm2:
Failed to run installation scripts
Updating Hooks...Done
Интернет курил но решения так и не нашел
- joshua
- Сообщений: 6
- Зарегистрирован: 23 янв 2019, 18:25
Re: не активируется и не обновляется pm2
ded » 24 янв 2019, 11:56
Вы не ошиблись форумом? разделом? IMHO — это точно не вопросы новичков.
- ded
- Сообщений: 15457
- Зарегистрирован: 26 авг 2010, 19:00
Re: не активируется и не обновляется pm2
joshua » 24 янв 2019, 17:38
ну я не Гуру Астриска… поэтому от греха подальше ![]()
- joshua
- Сообщений: 6
- Зарегистрирован: 23 янв 2019, 18:25
Re: не активируется и не обновляется pm2
ded » 24 янв 2019, 18:43
Понимаю. Я тоже.
Похоже надо всего два раздела на форуме:
Громы и Молнии Гуру (тут они будут друг в друга кидаться и язвить напропалую),
Для новичков.
For some weird reason the very short “internal name” of that module (pm2) is used when dependencies are shown instead of its description (“Process Management”)
Try installing pm2 from the shell:
fwconsole ma downloadinstall pm2
https://community.freepbx.org/t/the-mod … ired/40744
Если при этом
Node is not installed
то
You need to install nodejs (nodejs-legacy)
но это не решает проблем, как пишут по ссылке выше, поэтому сначала следуйте инструкциям
https://nodejs.org/en/download/package- … tributions
а уж потом
fwconsole ma downloadinstall pm2
- ded
- Сообщений: 15457
- Зарегистрирован: 26 авг 2010, 19:00
Re: не активируется и не обновляется pm2
joshua » 24 янв 2019, 22:42
в том то и загвоздка. с дистром в комплекте есть нод. 6.11.3
пробовал обновить его до крайней — яйши те же, ошибка та же. т.е. по логике ошибка не в нем
пробовал pm2 удалить. через веб морду не дает, через консоль — без проблем.
дальше пробовал установить через fwconsole ma downloadinstall pm2 — загружает, но при установке по сути та же ошибка:
- Код: выделить все
root@raspbx:~# fwconsole ma downloadinstall pm2
No repos specified, using: [standard,extended] from last GUI settingsDownloading module 'pm2'
Processing pm2
Verifying local module download...Verified
Extracting...Done
Download completed in 18 seconds
Installing/Updating Required Libraries. This may take a while...The following messages are ONLY FOR DEBUGGING. Ignore anything that says 'WARN' or is just a warning
Found npm-cache v0.7.0
Running installation..
[npm-cache] [INFO] using /home/asterisk/.package_cache as cache directory
[npm-cache] [INFO] [composer] Dependency config file /var/www/html/admin/modules/pm2/node/composer.json does not exist. Skipping install
[npm-cache] [INFO] [npm] config file exists
[npm-cache] [INFO] [npm] cli exists
[npm-cache] [INFO] [npm] hash of /var/www/html/admin/modules/pm2/node/package.json: 72e37e0910b4ea542a3fc885a90f5372
[npm-cache] [INFO] [npm] running [npm install]...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mixin-deep@^1.2.0 (node_modules/base/node_modules/mixin-deep):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Failed to parse json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: No data, empty input at 1:1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ^
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: File: /home/asterisk/.npm/mixin-deep/1.3.1/package/package.json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: class-utils@^0.3.5 (node_modules/base/node_modules/class-utils):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Failed to parse json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: No data, empty input at 1:1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ^
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: File: /home/asterisk/.npm/class-utils/0.3.6/package/package.json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: component-emitter@^1.2.1 (node_modules/base/node_modules/component-emitter):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Failed to parse json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: No data, empty input at 1:1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ^
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: File: /home/asterisk/.npm/component-emitter/1.2.1/package/package.json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pascalcase@^0.1.1 (node_modules/base/node_modules/pascalcase):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Failed to parse json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: No data, empty input at 1:1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ^
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: File: /home/asterisk/.npm/pascalcase/0.1.1/package/package.json
npm ERR! Linux 4.14.79-v7+
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! file /home/asterisk/.npm/cache-base/1.0.1/package/package.json
npm ERR! code EJSONPARSEnpm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: /home/asterisk/.npm/cache-base/1.0.1/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parsenpm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/admin/modules/pm2/node/npm-debug.log
[npm-cache] [ERROR] [npm] error running npm install
[npm-cache] [ERROR] error installing dependenciesFinished updating libraries!
There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
Unable to install module pm2:
- Failed to run installation scripts
Updating Hooks...Done
- joshua
- Сообщений: 6
- Зарегистрирован: 23 янв 2019, 18:25
Re: не активируется и не обновляется pm2
LordDeNide » 24 фев 2022, 23:37
Я нашел решение этой проблемы у меня получилось:
curl -sL
https://deb.nodesource.com/setup_10.x
| sudo -E bash —
apt install -y nodejs
fwconsole ma remove pm2 —force
rm -rf /home/asterisk/.package_cache/npm/
rm -rf /home/asterisk/.npm
fwconsole ma downloadinstall pm2
- LordDeNide
- Сообщений: 1
- Зарегистрирован: 24 фев 2022, 23:34
Вернуться в Вопросы новичков
Кто сейчас на форуме
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
pddkhanh opened this issue
Feb 17, 2016
· 15 comments
Comments
Hi team, thank you for you great work. I’m trying to install pm2 to my ubuntu server but got this error. Please help me.
Environment: Ubuntu 14.04
Node: v5.6.0
Npm: 3.6.0
Error:
/opt/node/bin/pm2 -> /opt/node/lib/node_modules/pm2/bin/pm2
/opt/node/bin/pm2-dev -> /opt/node/lib/node_modules/pm2/bin/pm2-dev
/opt/node/lib
└─┬ pm2@1.0.1
└── ikt@0.0.0 (git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228)
npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.7
Same problem,
Environment:
CentOS 7
npm 3.7.2
Thanks.
Having same issue on:
- Ubuntu 14.04
- Node v5.6.0
- Npm 3.7.3
npm i -g pm2 /home/ubuntu/.nvm/versions/node/v5.6.0/bin/pm2 -> /home/ubuntu/.nvm/versions/node/v5.6.0/lib/node_modules/pm2/bin/pm2 /home/ubuntu/.nvm/versions/node/v5.6.0/bin/pm2-dev -> /home/ubuntu/.nvm/versions/node/v5.6.0/lib/node_modules/pm2/bin/pm2-dev /home/ubuntu/.nvm/versions/node/v5.6.0/lib └─┬ pm2@1.0.1 └── ikt@0.0.0 (git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228) npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.8
I don’t see any errors everything is fine with those messages.
I have the same issue
ubuntu@____:~$ sudo npm install pm2 -g
/usr/bin/pm2 -> /usr/lib/node_modules/pm2/bin/pm2
/usr/bin/pm2-dev -> /usr/lib/node_modules/pm2/bin/pm2-dev
/usr/lib
└─┬ pm2@1.0.1
└── ikt@0.0.0 (git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228)
npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.8
No errors there only warnings.
Le mar. 23 févr. 2016 à 14:28, Andrew notifications@github.com a écrit :
I have the same issue
ubuntu@____:~$ sudo npm install pm2 -g
/usr/bin/pm2 -> /usr/lib/node_modules/pm2/bin/pm2
/usr/bin/pm2-dev -> /usr/lib/node_modules/pm2/bin/pm2-dev
/usr/lib
└─┬ pm2@1.0.1
└── ikt@0.0.0 (git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228)npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.8—
Reply to this email directly or view it on GitHub
#1951 (comment).
It’s perfectly fine, fsevents is used by developers to watch the file system for new builds. It is only compatible with Mac OSX, safe to ignore this warning.
As @mcrawshaw told, this is not really an issue, just an warning for an optional dependency.
It’s perfectly fine, fsevents is used by developers to watch the file system for new builds. It is only compatible with Mac OSX, safe to ignore this warning.
@mcrawshaw I was dealing with this today in a couple of Ubuntu servers meanwhile I was testing pm2,nodemon, forever.., It’s just me or do I really need to use this only in a Mac OS enviroment ?
After checking this I solve the problem, We need to add an explanation on this, after checking in xenial I was able to install using npm in this way:
npm install --no-optional pm2 or
npm install -g --no-optional pm2
I’ve seen many issues with the same problem including this.
Regards.
It’s perfectly fine, fsevents is used by developers to watch the file system for new builds. It is only compatible with Mac OSX, safe to ignore this warning.
For me this is not a warning but error and breaks build of docker image:
npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.1
/bin/sh: 1: systemctl: not found
The command '/bin/sh -c ... && apt-get install -y nodejs npm build-essential php php7.0-fpm php7.0-sqlite php7.0-curl php7.0-mbstring sqlite3 git && npm install -g pm2 && .... returned a non-zero code: 127
@agilob It isnt the warning that make your build crash, but /bin/sh: 1: systemctl: not found
@vmarchaud adding --no-optional to npm install -g pm2 passed the build, for sure it’s not apt-get and git clone that is crashing the build.
Can anyone possibly help me with this? I also can’t apply config in the FreePBX UI 🙁
——————
root@ubuntu:~/freepbx# fwconsole ma downloadinstall pm2
No repos specified, using: [standard] from last GUI settings
Downloading module ‘pm2’
Processing pm2
Verifying local module download…Verified
Extracting…Done
Download completed in 2 seconds
sh: 1: npm: not found
Node Package Manager is not installed
Unable to install module pm2:
— Failed to run installation scripts
Updating Hooks…Done
Chowning directories…Done
Also this:
————-
root@ubuntu:~# fwconsole reload —verbose
Reload Started
In Self_Helper.class.php line 212:
[Exception (404)]
Unable to locate the FreePBX BMO Class ‘Pm2’A required module might be disabled or uninstalled. Recommended steps (run from the CLI): 1) fwconsole ma install pm2 2
) fwconsole ma enable pm2
Exception trace:
() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:212
FreePBXSelf_Helper->loadObject() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:106
FreePBXSelf_Helper->autoLoad() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:37
FreePBXSelf_Helper->__get() at /var/www/html/admin/modules/core/Core.class.php:3936
FreePBXmodulesCore->preReloadFreepbx() at /var/www/html/admin/modules/core/Core.class.php:3918
FreePBXmodulesCore->fastAGIStatus() at /var/www/html/admin/libraries/extensions.class.php:1307
ext_agi->output() at /var/www/html/admin/libraries/extensions.class.php:418
extensions->generateConf() at /var/www/html/admin/libraries/Console/Reload.class.php:329
FreePBXConsoleCommandReload->reload() at /var/www/html/admin/libraries/Console/Reload.class.php:91
FreePBXConsoleCommandReload->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Command/Command.php:255
SymfonyComponentConsoleCommandCommand->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:960
SymfonyComponentConsoleApplication->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:255
SymfonyComponentConsoleApplication->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:148
SymfonyComponentConsoleApplication->run() at /var/lib/asterisk/bin/fwconsole:163
reload [—json] [—dry-run] [—skip-registry-checks] [—dont-reload-asterisk]
root@ubuntu:~#
——————
Also getting warning in FreePBX gui:
«PM2 Not installed»
——-
Also this:
root@ubuntu:~# fwconsole ma downloadinstall pm2
No repos specified, using: [standard] from last GUI settings
Downloading module ‘pm2’
Processing pm2
Verifying local module download…Verified
Extracting…Done
Download completed in 2 seconds
sh: 1: node: not found
Node is not installed
Unable to install module pm2:
— Failed to run installation scripts
Updating Hooks…Done
Chowning directories…Done
I want to install pm2 on my rasspberry pi 3:
npm install -g pm2
but i get this error:
(node:5118) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use
os.tmpdir() instead.
npm ERR! Error: Method Not Allowed
npm ERR! at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
npm ERR! at /usr/share/npm/lib/cache/add-named.js:203:12
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 4.9.59-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /home/pi/JSMTProxy
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/JSMTProxy/npm-debug.log
npm ERR! not ok code 0
I try to add sudo before the command but nothing change.
asked Aug 28, 2018 at 9:51
1
You need to update npm.
Use the following command and try again:
npm install -g npm@latest
answered Aug 30, 2018 at 22:54
![]()
progmprogm
2,6623 gold badges13 silver badges32 bronze badges
2
This topic has been deleted. Only users with topic management privileges can see it.
-
Anyone have a solution? Error is below:
[[email protected] ~]# fwconsole ma downloadinstall pm2 No repos specified, using: [standard,commercial] from last GUI settings Starting pm2 download.. Processing pm2 Verifying local module download...Verified Extracting...Done Module pm2 successfully downloaded Installing/Updating Required Libraries. This may take a while...The following messages are ONLY FOR DEBUGGING. Ignore anything that says 'WARN' or is just a warning The command "runuser -l 'asterisk' -c 'cd /var/www/html/admin/modules/pm2/node && mkdir -p /home/asterisk/.pm2 && mkdir -p logs && export HOME="/home/asterisk" && export PM2_HOME="/home/asterisk/.pm2" && export ASTLOGDIR="/var/log/asterisk" && export ASTVARLIBDIR="/var/lib/asterisk" && export PATH="$HOME/.node/bin:$PATH" && export NODE_PATH="$HOME/.node/lib/node_modules:$NODE_PATH" && export MANPATH="$HOME/.node/share/man:$MANPATH" && npm-cache -v'" failed. Exit Code: 127(Command not found) Output: ================ Error Output: ================ -bash: npm-cache: command not found Unable to install module pm2: - Failed to run installation scripts Updating Hooks...Done [[email protected] ~]# -
Try ….
yum install npm-cache -
@scottalanmiller said in FreePBX — npm-cache: command not found:
yum install npm-cache
No package npm-cache available. -
In February Sangoma said to hold tight as it is broken and needs to be updated. Are you sure that you are on the latest release and fully updated right now? Maybe it has been fixed but the fixed has not been added to yours yet?
-
Why are you on a command line at all?
-
@scottalanmiller said in FreePBX — npm-cache: command not found:
In February Sangoma said to hold tight as it is broken and needs to be updated. Are you sure that you are on the latest release and fully updated right now? Maybe it has been fixed but the fixed has not been added to yours yet?
Current systems have pm2 implemented
-
@JaredBusch said in FreePBX — npm-cache: command not found:
@scottalanmiller said in FreePBX — npm-cache: command not found:
In February Sangoma said to hold tight as it is broken and needs to be updated. Are you sure that you are on the latest release and fully updated right now? Maybe it has been fixed but the fixed has not been added to yours yet?
Current systems have pm2 implemented
Yeah, that’s why I was wondering if he was on something from pre-February 11th.
-
@scottalanmiller said in FreePBX — npm-cache: command not found:
@JaredBusch said in FreePBX — npm-cache: command not found:
@scottalanmiller said in FreePBX — npm-cache: command not found:
In February Sangoma said to hold tight as it is broken and needs to be updated. Are you sure that you are on the latest release and fully updated right now? Maybe it has been fixed but the fixed has not been added to yours yet?
Current systems have pm2 implemented
Yeah, that’s why I was wondering if he was on something from pre-February 11th.
To reinforce this, I have systems predating Feb that use pm2 because they were all updated following the normal update processes.
-
@JaredBusch said in FreePBX — npm-cache: command not found:
Why are you on a command line at all?
Just to troubleshoot
-
@aaronstuder said in FreePBX — npm-cache: command not found:
@JaredBusch said in FreePBX — npm-cache: command not found:
Why are you on a command line at all?
Just to troubleshoot
Then post your actual problem. Not a problem with your troubleshooting
-
Anyone care to wager? I bet the issue is he tried to update modules without updating firmware.
-
@JaredBusch said in FreePBX — npm-cache: command not found:
Anyone care to wager? I bet the issue is he tried to update modules without updating firmware.
You might be right. How do I fix it?
-
@aaronstuder said in FreePBX — npm-cache: command not found:
@JaredBusch said in FreePBX — npm-cache: command not found:
Anyone care to wager? I bet the issue is he tried to update modules without updating firmware.
You might be right. How do I fix it?
https://mangolassi.it/topic/13143/upgrading-the-freepbx-firmware
-
@JaredBusch said in FreePBX — npm-cache: command not found:
@scottalanmiller said in FreePBX — npm-cache: command not found:
In February Sangoma said to hold tight as it is broken and needs to be updated. Are you sure that you are on the latest release and fully updated right now? Maybe it has been fixed but the fixed has not been added to yours yet?
Current systems have pm2 implemented
FreePBX 14 RC1 is missing this and the command line won’t add it. But the GUI does.
-
How is FreePBX 14 RC 1 looking?
-
@StrongBad said in FreePBX — npm-cache: command not found:
How is FreePBX 14 RC 1 looking?
So far it has been great. Found one really minor issue, but trivial to fix. Otherwise so far it’s been really good.
-
Still having the issue. All updates are installed.
-
npm ERR! Linux 2.6.32-642.6.2.el6.x86_64 npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" npm ERR! node v0.12.18 npm ERR! npm v2.15.11 npm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED npm ERR! syscall connect npm ERR! Error: connect ECONNREFUSED npm ERR! at exports._errnoException (util.js:746:11) npm ERR! at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1012:19) npm ERR! { [Error: connect ECONNREFUSED] npm ERR! code: 'ECONNREFUSED', npm ERR! errno: 'ECONNREFUSED', npm ERR! syscall: 'connect', npm ERR! parent: 'pm2' } npm ERR! npm ERR! If you are behind a proxy, please make sure that the npm ERR! 'proxy' config is set properly. See: 'npm help config' npm ERR! Please include the following file with any support request: npm ERR! /var/www/html/admin/modules/pm2/node/npm-debug.log [[email protected] ~]#` -
Loaded plugins: fastestmirror, kmod Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package nodejs.x86_64 0:0.12.18-1nodesource.el6 will be erased --> Processing Dependency: nodejs for package: freepbx-13.0.192.8-1.shmz65.1.56.noarch --> Running transaction check ---> Package freepbx.noarch 0:13.0.192.8-1.shmz65.1.56 will be erased --> Finished Dependency Resolution Dependencies Resolved Package Arch Version Repository Size Removing: nodejs x86_64 0.12.18-1nodesource.el6 @pbx 25 M Removing for dependencies: freepbx noarch 13.0.192.8-1.shmz65.1.56 @pbx 200 M Transaction Summary Remove 2 Package(s) Installed size: 225 M Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : freepbx-13.0.192.8-1.shmz65.1.56.noarch 1/2 Erasing : nodejs-0.12.18-1nodesource.el6.x86_64 2/2 Verifying : freepbx-13.0.192.8-1.shmz65.1.56.noarch 1/2 Verifying : nodejs-0.12.18-1nodesource.el6.x86_64 2/2 Removed: nodejs.x86_64 0:0.12.18-1nodesource.el6 Dependency Removed: freepbx.noarch 0:13.0.192.8-1.shmz65.1.56 Complete! -
@aaronstuder said in FreePBX — npm-cache: command not found:
Erasing : freepbx-13.0.192.8-1.shmz65.1.56.noarch
Um…. This seems bad? @JaredBusch
Я установил node.js и npm на свой сервер CentOS 7. Но у меня проблемы с pm2. На самом деле настоящая проблема в том, что у меня нет опыта работы с Linux, и я не знаю, как изменить путь. Вот структура папок.
* bin
* code
* error_docs
* httpdocs
* lib64
* logs
* tmp
* var
* chat(my node.js folder)
* node_modules
* pm2
* sockjs
* server.js
* dev
* etc
* lib
* local
* sbin
* usr
Я вошел в папку, набрав cd chat, и установил pm2 с npm install pm2.
После этого я попытался использовать pm2 для моего server.js, набрав pm2 server.js сервер возвращает «pm2 command not found». Я могу использовать node.js без проблем, но pm2 не работает.
Как я могу это решить?
8 ответов
Лучший ответ
Установите PM2 глобально:
Запустить от имени root:
npm i -g pm2
Или если пользователь sudo-er
sudo npm i -g pm2
А затем вернитесь к пользователю (или оставайтесь в root, если он был создан пользователем root) и запустите его:
pm2 start server.js
79
num8er
4 Июл 2016 в 13:22
Если вы использовали nvm для установки node и npm, установите pm2 для обычного пользователя.
Запустить от имени root:
sudo su
vim ~/.bashrc
Добавьте код ниже, измените NVM_DIR на домашнюю папку обычного пользователя:
export NVM_DIR="/home/[PLEASE CHANGE]/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && .
"$NVM_DIR/bash_completion"
# This loads nvm bash_completion
В конце концов :
source ~/.bashrc
0
ke deng
26 Июн 2019 в 21:16
Ошибка при использовании порта 80 с PM2?
Неправильный способ сделать это — попытаться запустить с sudo.
Правильный способ сделать это — войти в систему как root sudo su, а затем запустить pm2 start app.js --name "whatever" --watch.
При входе в систему как root нет необходимости настраивать какие-либо bashrc или файлы профиля. Однако, как root, скрипт может опасно использовать функцию nodejs exec(). Чтобы этого избежать, сначала выполните корневую работу с помощью своего скрипта, а затем снизьте свои привилегии по истечении некоторого времени ожидания:
// I use port 80 first.. at this point the script's UID is root.
app.listen(80);
// After 2 seconds we switch to UID `azureuser`, which obviously isn't root anymore.
setTimeout(function() {
process.setuid("azureuser");
}, 2000);
1
Obsidian Age
8 Мар 2017 в 19:54
PM2 — менеджер процессов для приложений Node.js. PM2 в основном управляет приложениями (запускает их в фоновом режиме как службу). Итак, вот как мы устанавливаем PM2 глобально с учетной записью разрешений sudo
sudo npm install -g pm2
Параметр -g указывает npm установить модуль глобально, чтобы он был доступен для всей системы. После установки проверьте установленный путь как:
whereis pm2
pm2: /opt/node/bin/pm2 /opt/node/lib/node_modules/pm2/bin/pm2
Теперь нам нужно добавить этот путь в сценарий запуска bash. Добавьте следующую строку в любом месте файла ~ / .bashrc.
export PATH=$PATH:/opt/node/lib/node_modules/pm2/bin
Теперь повторно войдите в систему или создайте сценарий bash следующим образом (чтобы сценарий bash запускался и путь был установлен)
source ~/.bashrc
И теперь он должен работать. проверить статус pm2
pm2 status
17
Nicks
25 Дек 2016 в 00:11
Мне помог такой вариант:
sudo npm i -g pm2
1
Alexander Ezhov
6 Авг 2019 в 07:49
Установите PM2 глобально и запустите все как пользователь root
sudo apt-get install npm
sudo npm i -g pm2
sudo ln -s /usr/bin/nodejs /usr/bin/node
Тебе хорошо идти
0
Andronicus
25 Фев 2019 в 05:55
sudo npm i -g pm2
У меня это сработало.
0
slfan
30 Окт 2019 в 05:33
Если вы устанавливаете через NPM и он не работает, вы также можете создать символическую ссылку:
ln -s /<your-user>/.npm-global/lib/node_modules/pm2/bin/pm2 /usr/bin/pm2
После этого вы сможете позвонить:
pm2
0
Felipe Pereira
7 Янв 2020 в 21:14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
leabdalla opened this issue
Nov 22, 2013
· 19 comments
Closed
cannot install on ubuntu
#188
leabdalla opened this issue
Nov 22, 2013
· 19 comments
Comments
in OSX install runs fine, but not in DigitalOcean Ubuntu via ssh (as root)
root@bdev:~/local/bin# npm install -g pm2
npm http GET https://registry.npmjs.org/pm2
npm http 304 https://registry.npmjs.org/pm2
npm http GET https://registry.npmjs.org/cli-table/0.2.0
npm http GET https://registry.npmjs.org/pm2-multimeter/0.1.2
npm http GET https://registry.npmjs.org/usage/0.3.9
npm http GET https://registry.npmjs.org/axon-rpc/0.0.2
npm http GET https://registry.npmjs.org/watch/0.8.0
npm http GET https://registry.npmjs.org/axon/1.0.0
npm http GET https://registry.npmjs.org/cron/1.0.1
npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/colors/0.6.2
npm http GET https://registry.npmjs.org/eventemitter2/0.4.13
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/commander/2.0.0
npm http 304 https://registry.npmjs.org/usage/0.3.9
npm http 304 https://registry.npmjs.org/axon-rpc/0.0.2
npm http 304 https://registry.npmjs.org/cli-table/0.2.0
npm http 304 https://registry.npmjs.org/watch/0.8.0
npm http 304 https://registry.npmjs.org/axon/1.0.0
npm http 304 https://registry.npmjs.org/cron/1.0.1
npm http 304 https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/colors/0.6.2
npm http 304 https://registry.npmjs.org/pm2-multimeter/0.1.2
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/eventemitter2/0.4.13
npm http 304 https://registry.npmjs.org/commander/2.0.0
npm http GET https://registry.npmjs.org/commander/1.0.5
npm http GET https://registry.npmjs.org/charm
npm http GET https://registry.npmjs.org/colors/0.3.0
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/configurable/0.0.1
npm http GET https://registry.npmjs.org/escape-regexp/0.0.1
npm http 304 https://registry.npmjs.org/commander/1.0.5
npm http 304 https://registry.npmjs.org/charm
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/colors/0.3.0
npm http 304 https://registry.npmjs.org/escape-regexp/0.0.1
npm http 304 https://registry.npmjs.org/configurable/0.0.1
> usage@0.3.9 install /root/local/lib/node_modules/pm2/node_modules/usage
> node-gyp rebuild
sh: 1: node-gyp: Permission denied
npm http GET https://registry.npmjs.org/keypress
npm ERR! Error: ENOENT, chown '/root/local/lib/node_modules/pm2/node_modules/axon/node_modules/escape-regexp/Makefile'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.2.0-24-virtual
npm ERR! command "node" "/root/local/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /root/local/bin
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.15
npm ERR! path /root/local/lib/node_modules/pm2/node_modules/axon/node_modules/escape-regexp/Makefile
npm ERR! fstream_path /root/local/lib/node_modules/pm2/node_modules/axon/node_modules/escape-regexp/Makefile
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /root/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack /root/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/root/local/lib/node_modules/pm2/node_modules/axon/node_modules/configurable/History.md'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.2.0-24-virtual
npm ERR! command "node" "/root/local/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /root/local/bin
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.15
npm ERR! path /root/local/lib/node_modules/pm2/node_modules/axon/node_modules/configurable/History.md
npm ERR! fstream_path /root/local/lib/node_modules/pm2/node_modules/axon/node_modules/configurable/History.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /root/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! usage@0.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the usage@0.3.9 install script.
npm ERR! This is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls usage
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.2.0-24-virtual
npm ERR! command "node" "/root/local/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /root/local/bin
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.15
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/keypress
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/local/bin/npm-debug.log
npm ERR! not ok code 0
root@bdev:~/local/bin#
I see the same error currently. But for now it seems that the problem is with the package «usage@0.3.9» hope to find a fix soon.
PM2 Has been using the same (current) version of that package for a while, so I don’t think that’s the problem. The error message to me looks like you might not have node-gyp installed correctly.
How did you install node on Ubuntu? Did you follow the instructions Node.js provides for Ubuntu?
Specifically, make sure you have python, g++, and make installed:
sudo apt-get install -y python-software-properties python g++ make
If you installed node from apt-get, make sure you didn’t install it from the outdated default repository. If you didn’t install via apt-get, you may also need to install node-gyp itself.
Using Node on Ubuntu with NVM works ok now.
I have tested this with Python 2.7.
Here are two ways to run this:
Normal user (e.g. node)
NVM: INSTALL VIA https://github.com/creationix/nvm
NVM: INSTALL NODE VERSION
Fix that works with the root user
Installed NVM as root and installed node version is v0.10.22.
If you are running with the root user, one fix is to install pm2 into a directory and move it to the global repo:
cd ~/
npm install pm2
mv node_modules/pm2 ~/.nvm/v0.10.22/node_modules/pm2
ln -s ~/.nvm/v0.10.22/node_modules/pm2/bin/pm2 ~/.nvm/v0.10.22/bin/pm2
@cspiegl it doesn’t sound like there is a «fix» here besides you need to be running the right version of node and have node-gyp and its dependencies installed. That’s why I was asking what process you used to install node. If you followed the instructions I linked to on nodejs.org, it should install fine without nvm (I install from scratch on Ubuntu fairly regularly without problem).
The problem I found mainly was that I installed from scratch on node and wanted to run as root on my development machine. And that did not work if I used npm install pm2 -g. Than I did the above steps and both worked.
@cspiegl Interesting. I just tried npm install pm2 -g as root and it succeeded, and I can run pm2 as root just fine.
If you’re solution works for you, I guess that’s what matters. This doesn’t sound like a common use case to me, anyway.
I found it weird that it did not work. But now it works. I am happy. But I plan on using a node user anyways. So that problem will likely never arise again for me.
Just hope this helps someone someday ;-).
This isn’t fixed. Still a problem for me! Neither «fix» fixes this.
Got the same under latest ubuntu, with latest node, npm and node-gyp
> usage@0.3.9 install /usr/local/lib/node_modules/pm2/node_modules/usage
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.10.26"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/pm2/node_modules/usage/.node-gyp"
gyp http GET http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-18-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/pm2/node_modules/usage
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/configurable/0.0.1
npm http 304 https://registry.npmjs.org/charm
npm http 304 https://registry.npmjs.org/escape-regexp/0.0.1
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/mkdirp
npm ERR! usage@0.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usage@0.3.9 install script.
npm ERR! This is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls usage
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-18-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /home/fragger
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/fragger/npm-debug.log
npm ERR! not ok code 0
Ran into this same problem on a new digital ocean droplet (Ubuntu 13.10 x64). Fixed it by switching to node v0.10.24 to do the install. So far (fingers crossed) switching back to v0.10.26 after installing seems to work.
Same here. I can’t install pm2 on DigitalOcean 14.04 x64 and it also doesn’t work on my 13.10 dev machine. I installed node using nvm and I want to keep it that way.
Thanks to a workaround posted in node-gyp #363, I was able to resolve this issue when installing pm2 on CentOS 6.5 with python 2.6.6 already installed.
My basic steps:
# install node and npm ...
rm -rf $(dirname `python -c 'import gyp; print gyp.__file__'`)
npm install -g node-gyp
npm install -g pm2
! solution for mac
go to ~/.npm dir and remove all pm2 packages (about 4 units)
npm cache clear -f does exactly this
using:
npm cache clear -f
and
npm install pm2 -g —unsafe-perm
worked for me.
Same here. Using Ubuntu 14.04.1. I had the errors below. The commands given above solved the problem:
npm cache clear -f
npm install pm2 -g --unsafe-perm
The errors were
pedro@clima:~$ sudo npm install -g pm2
/
> pm2@0.11.1 preinstall /usr/lib/node_modules/pm2
> bash ./scripts/preinstall.sh
##### PM2 INSTALLATION
#
#
# As you run PM2 as root, to update PM2 automatically
# you must add the --unsafe-perm flag.
#
# $ npm install pm2 -g --unsafe-perm
#
# Else run the installation as a non root user
#
#
#
######
npm ERR! pm2@0.11.1 preinstall: `bash ./scripts/preinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pm2@0.11.1 preinstall script.
npm ERR! This is most likely a problem with the pm2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bash ./scripts/preinstall.sh
npm ERR! You can get their info via:
npm ERR! npm owner ls pm2
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /home/pedro/node
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
I just install at digital ocean droplet with ubuntu 14.04 node v0.10.25 and 1.3.10 but when i type pm2 start server.js. the console just close the command. like nothing happen. anyone have a solution?