How to update npm on an OpenShift gear?

2019-02-19 23:10发布

问题:

How can I update npm on OpenShift?

I'm having problems while deploying because npm started using ^1.2.3 version notations and it's not compatible with the current npm in my application:

remote: npm ERR! Error: No compatible version found: through@'^2.3.4'
remote: npm ERR! Valid install targets:
remote: npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","1.0.0","1.1.0","1.1.1","1.1.2","2.0.0","2.1.0","2.2.0","2.2.1","2.2.2","2.2.4","2.2.5","2.2.6","2.2.7","2.3.1","2.3.2","2.3.3","2.3.4"]

Is there a way of fixing this, or I'll have to go back to outdated packages?

回答1:

OpenShift does not provide root access to developers, but you can still select a custom version of npm by running your own nodejs binary in user space.

Developers can also package up their own custom nodejs cartridge, allowing teams to define and standardize their dependencies in a reusable way.

Here is an answer that helps you run a custom version of Nodejs on OpenShift

You can also try working with user-defined npm globals on OpenShift