Npm:在UBUNTU上找不到模块'../lib/utils/unsupported.js'

时间:2020-08-31 13:56:30

标签: ubuntu npm

使用 npm install

时出现错误提示
module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /usr/sbin/npm:19:21
    at Object.<anonymous> (/usr/sbin/npm:155:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

请帮助。

1 个答案:

答案 0 :(得分:0)

看起来您在使用npm时正在使用相对路径

做:

public class CliWebServiceAutentication extends org.apache.axis.handlers.http.HTTPAuthHandler
{
    //org.apache.axis.handlers.SimpleAuthenticationHandler{
    private static final long serialVersionUID = 1L;

    //protected static Log log = LogFactory.getLog(HTTPAuthHandler.class.getName());

    public void invoke(org.apache.axis.MessageContext msgContext) throws org.apache.axis.AxisFault
    {
        super.invoke(msgContext);

        String username = "";
        String password = "";

        String WEBSERVICE_SICUREZZA_ATTIVA = "SI";
        String WEBSERVICE_USERNAME = "User";
        String WEBSERVICE_PASSWORD = "Password";

        try
        {
            Iterator i = msgContext.getRequestMessage().getMimeHeaders().getAllHeaders();
            while (i.hasNext())
            {
                javax.xml.soap.MimeHeader o = (javax.xml.soap.MimeHeader) i.next();

                if ("Username".equalsIgnoreCase(o.getName()))
                {
                    username = o.getValue();
                }
                if ("Password".equalsIgnoreCase(o.getName()))
                {
                    password = o.getValue();
                }
            }

            if (msgContext.getPassword() != null)
            {
                password = msgContext.getPassword();
            }
            if (msgContext.getUsername() != null)
            {
                username = msgContext.getUsername();
            }

        }
        catch (Exception e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
            throw new org.apache.axis.AxisFault(e.getMessage());
        }
        if ("SI".equals(WEBSERVICE_SICUREZZA_ATTIVA))
        {
            if (WEBSERVICE_USERNAME.equals(username) && (WEBSERVICE_PASSWORD.equals(password)))
            {
                LogManager.log().info(CliWebServiceAutentication.class, "CliWebServiceAutentication autorizzato " + username, "");
            }
            else
            {
                LogManager.log().errore(CliWebServiceAutentication.class, "CliWebServiceAutentication NON autorizzato " + username, "");
                throw new org.apache.axis.AxisFault("Autentication failed");
            }
        }
    }

它应该提供类似which npm -a

的输出

然后使用npm的绝对路径,即 / usr / bin / npm

应该可以。