Problems Upgrading UCP Node

SOLUTION:

yum remove nodejs
yum remove npm
yum install nodejs
amportal a ma uninstall ucpnode
amportal a ma remove ucpnode
amportal a ma download ucpnode
amportal a ma install ucpnode

REASONING:

Node JS rapidly changes and has updates. Unfortunately we were caught in the middle of an update to a sub module that needed a newer version of nodejs. The RPM we were originally using didn’t work well with upgrades so we had to change versions.

ORIGINAL THREAD

I’ve just done a fresh install of the x86_64 distro. In the process of upgrading modules the UCP Node Server module was disabled pending the upgrade of npm.

When I run this I get:

[root@localhost log]# npm install npm -g
/usr/bin/npm → /usr/lib/node_modules/npm/bin/npm-cli.js
npm ERR! Refusing to delete: /usr/share/man/man7/removing-npm.7 not in /usr/lib/node_modules/npm
File exists: /usr/share/man/man7/removing-npm.7
Move it away, and try again.

npm ERR! System Linux 2.6.32-504.8.1.el6.x86_64
npm ERR! command “/usr/bin/node” “/usr/bin/npm” “install” “npm” “-g”
npm ERR! cwd /var/log
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path /usr/share/man/man7/removing-npm.7
npm ERR! code EEXIST
npm ERR! not ok code 0

If I move it away the process iterates through a similar loop reporting another problem with another link.

But before I can re-run the command I’ll see:

[root@localhost log]# npm install npm -g
-bash: /usr/bin/npm: No such file or directory

And need to re-link it to /usr/lib/node_modules/npm/bin/npm-cli.js

Alan

yum remove nodejs
yum remove npm
yum install nodejs
amportal a ma uninstall ucpnode
amportal a ma remove ucpnode
amportal a ma download ucpnode
amportal a ma install ucpnode

Thank you Andrew. That resolved the issue.

Just to note for others this was a 13 Beta install.

Alan

This will work in 12 as well. Basically we (Sangoma) got kind of screwed by a downstream package. It will be a pretty painful process to/for most people (as in youll have to run those commands). We now maintain our own Node JS moving forward.

1 Like

Whilst this resolved the npm issue I was unable to install UCP after following this process:

[root@localhost ~]# fwconsole ma install ucp
Refreshing all UCP Assets, this could take a while…
Generating Module Scripts…Done
Generating Module CSS…Done
Generating Main Scripts…Done
Generating Main CSS…Done
Done!

[Whoops\Exception\ErrorException]
in_array() expects parameter 2 to be array, null given

This is unreleated to UCP. Furthermore I need the full error.

fwconsole ma install ucp --verbose

Most-likely this was already fixed though. So please update your modules

1 Like

fwconsole ma install ucp --verbose
Refreshing all UCP Assets, this could take a while…
Generating Module Scripts…Done
Generating Module CSS…Done
Generating Main Scripts…Done
Generating Main CSS…Done
Done!

[Whoops\Exception\ErrorException]
in_array() expects parameter 2 to be array, null given

Exception trace:
() at /var/www/html/admin/modules/ucp/Ucp.class.php:781
Whoops\Run->handleError() at n/a:n/a
in_array() at /var/www/html/admin/modules/ucp/Ucp.class.php:781
Ucp->enableAllUsers() at /var/www/html/admin/modules/ucp/install.php:64
include_once() at /var/www/html/admin/libraries/modulefunctions.class.php:2363
module_functions->_doinclude() at /var/www/html/admin/libraries/modulefunctions.class.php:2315
module_functions->_runscripts() at /var/www/html/admin/libraries/modulefunctions.class.php:1878
module_functions->install() at /var/www/html/admin/libraries/Console/Moduleadmin.class.php:196
FreePBX\Console\Command\Moduleadmin->doInstall() at /var/www/html/admin/libraries/Console/Moduleadmin.class.php:866
FreePBX\Console\Command\Moduleadmin->handleArgs() at /var/www/html/admin/libraries/Console/Moduleadmin.class.php:87
FreePBX\Console\Command\Moduleadmin->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:132

Update to the newest version of UCP, which I just released: ucp v13.0.6

That has installed successfully.

Thanks

Getting error when trying to install module ucpnode:

[root@freepbx-b bin]# amportal a ma install ucpnode

Fetching FreePBX settings with gen_amp_conf.php…

module.js:340
throw err;
^
Error: Cannot find module 'inherits’
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/lib/node_modules/npmconf/npmconf.js:3:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Node Package Manager is not installed
Unable to install module ucpnode:

  • Failed to run installation scripts

Any ideas?

Try this:

http://community.freepbx.org/t/ucp-node-server-13-0-8-module-unable-to-update/30796/2?u=overkill

npm install npm -g returns:

[root@freepbx-b ~]# npm install npm -g

module.js:340
throw err;
^
Error: Cannot find module 'inherits’
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/lib/node_modules/npmconf/npmconf.js:3:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

its a issue with nodejs package. We have moved to building and maintaining our own nodejs RPMs so we do not get into this issue anymore with upstream package managers wrecking things on us.

Unfortunately you need to yum erase nodejs and then install nodejs

Ok so I would go yum erase nodejs and then yum install nodejs?

yes

yum remove nodejs*
yum install nodejs

Just tried the commands: remove and reinstall the nodejs, same output…Error(s) installing ucpnode:
Failed to run installation scripts.Not sure, tried this few times.

Tried by CLI and the ucpnode is not found — tried to search the db and no results. Does this node have a different name…
New to asterisk so pardon me for basic questions.

Worked for me.
Then did amportal a ma install ucpnode.

On FreePBX High Availability, do I have to do this on each server?

1 Like

The output doesn’t match the commands I said to run (EG: nodejs IS NOT ucpnode). Seems like there is a disconnect in what you are doing. Please run exactly what I post below:

yum remove nodejs
yum remove npm
yum install nodejs
amportal a ma uninstall ucpnode
amportal a ma remove ucpnode
amportal a ma download ucpnode
amportal a ma install ucpnode

Hi all I updated my Module’s today and i am getting the errors Below updating UCP Node Server 13.0.8

Is it ok to disable the module or remove it i am not sure what this module is for?
I have Included Debug log Also!

Please wait while module actions are performed
Installing ucpnode
Installing/Updating Required Libraries. This may take a while......................
Finished updating libraries!

There was an error installing. Please review the install log. (/var/www/html/admin/modules/ucpnode/node/logs/install.log)
Error(s) installing ucpnode:

    Failed to run installation scripts

Updating Hooks...Done

Here is output from /var/www/html/admin/modules/ucpnode/node/logs/install.log

npm ERR! Linux 2.6.32-504.8.1.el6.x86_64
npm ERR! argv “node” “/usr/bin/npm” “update”
npm ERR! node v0.10.29
npm ERR! npm v2.14.1
npm ERR! path /home/asterisk/.npm/node-xmpp-client/1.0.0-alpha18/package/package.json.a047f00fd6e9d0df60cf8de798fb2f80
npm ERR! code EACCES
npm ERR! errno 3

npm ERR! Error: EACCES, open ‘/home/asterisk/.npm/node-xmpp-client/1.0.0-alpha18/package/package.json.a047f00fd6e9d0df60cf8de798fb2f80’
npm ERR! { [Error: EACCES, open ‘/home/asterisk/.npm/node-xmpp-client/1.0.0-alpha18/package/package.json.a047f00fd6e9d0df60cf8de798fb2f80’]
npm ERR! errno: 3,
npm ERR! code: ‘EACCES’,
npm ERR! path: ‘/home/asterisk/.npm/node-xmpp-client/1.0.0-alpha18/package/package.json.a047f00fd6e9d0df60cf8de798fb2f80’,
npm ERR! parent: ‘ucp-server’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/admin/modules/ucpnode/node/npm-debug.log

Here is the Debug Log output! From /var/www/html/admin/modules/ucpnode/node/npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/bin/npm', 'install', 'ltx' ]
2 info using [email protected]
3 info using [email protected]
4 verbose install initial load of /var/www/html/admin/modules/ucpnode/node/package.json
5 verbose readDependencies loading dependencies from /var/www/html/admin/modules/ucpnode/node/package.json
6 silly cache add args [ '[email protected]', null ]
7 verbose cache add spec [email protected]
8 silly cache add parsed spec { raw: '[email protected]',
8 silly cache add   scope: null,
8 silly cache add   name: 'ltx',
8 silly cache add   rawSpec: '0.7.2',
8 silly cache add   spec: '0.7.2',
8 silly cache add   type: 'version' }
9 silly addNamed [email protected]
10 verbose addNamed "0.7.2" is a plain semver version for ltx
11 silly mapToRegistry name ltx
12 silly mapToRegistry using default registry
13 silly mapToRegistry registry https://registry.npmjs.org/
14 silly mapToRegistry uri https://registry.npmjs.org/ltx
15 verbose addNameVersion registry:https://registry.npmjs.org/ltx not in flight; fetching
16 verbose request uri https://registry.npmjs.org/ltx
17 verbose request no auth needed
18 info attempt registry request try #1 at 16:58:47
19 verbose request id 9ed1c150cbf24998
20 verbose etag "AD0818ZKVJK35YPP4ZVTCCKXR"
21 http request GET https://registry.npmjs.org/ltx
22 http 304 https://registry.npmjs.org/ltx
23 silly get cb [ 304,
23 silly get   { date: 'Sun, 30 Aug 2015 15:58:47 GMT',
23 silly get     via: '1.1 varnish',
23 silly get     'cache-control': 'max-age=60',
23 silly get     etag: '"AD0818ZKVJK35YPP4ZVTCCKXR"',
23 silly get     age: '2',
23 silly get     connection: 'keep-alive',
23 silly get     'x-served-by': 'cache-ams4125-AMS',
23 silly get     'x-cache': 'HIT',
23 silly get     'x-cache-hits': '6',
23 silly get     'x-timer': 'S1440950327.543168,VS0,VE0',
23 silly get     vary: 'Accept' } ]
24 verbose etag https://registry.npmjs.org/ltx from cache
25 verbose get saving ltx to /home/asterisk/.npm/registry.npmjs.org/ltx/.cache.json
26 silly cache afterAdd [email protected]
27 verbose afterAdd /home/asterisk/.npm/ltx/0.7.2/package/package.json not in flight; writing
28 verbose stack Error: EACCES, open '/home/asterisk/.npm/ltx/0.7.2/package/package.json.f2267cb8d2475dc02ea9d6a0533405c9'
29 verbose cwd /var/www/html/admin/modules/ucpnode/node
30 error Linux 2.6.32-504.8.1.el6.x86_64
31 error argv "node" "/usr/bin/npm" "install" "ltx"
32 error node v0.10.29
33 error npm  v2.14.1
34 error path /home/asterisk/.npm/ltx/0.7.2/package/package.json.f2267cb8d2475dc02ea9d6a0533405c9
35 error code EACCES
36 error errno 3
37 error Error: EACCES, open '/home/asterisk/.npm/ltx/0.7.2/package/package.json.f2267cb8d2475dc02ea9d6a0533405c9'
37 error  { [Error: EACCES, open '/home/asterisk/.npm/ltx/0.7.2/package/package.json.f2267cb8d2475dc02ea9d6a0533405c9']
37 error   errno: 3,
37 error   code: 'EACCES',
37 error   path: '/home/asterisk/.npm/ltx/0.7.2/package/package.json.f2267cb8d2475dc02ea9d6a0533405c9',
37 error   parent: 'ucp-server' }
38 error Please try running this command again as root/Administrator.
39 verbose exit [ 3, true ]

Hi Jim,

I had the same problem this morning and was hoping somebody would respond to your thread.

This version of UCPNODE requires an upgrade to NPM. From the Linux command line:

npm install npm -g

I discovered this by attempting to force install the module from the CLI and got a version error telling me to run the above command. Did so, everything worked.

EDIT: Tagging @tm1000 to make sure he knows what’s up =)