1
votes

I get the below error when I try to run npm install. I believe I successfully ran this without issue for another application.

npm install
Error: Failed to replace env in config: ${ADO_NPM_PAT}
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:429:13
    at String.replace (native)
    at envReplace (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:424:12)
    at parseField (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:400:7)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:338:17
    at Array.forEach (native)
    at Conf.add (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:337:23)
    at ConfigChain.addString (C:\Program Files\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
    at Conf.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:325:10)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16
>
>C:\Program Files\nodejs\node_modules\npm\lib\npm.js:29
    throw new Error('npm.load() required')
    ^
>
>Error: npm.load() required
    at Object.npm.config.get (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:29:11)
    at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:58:40)
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:387:3)
    at emitOne (events.js:77:13)
    at process.emit (events.js:169:7)
    at process._fatalException (node.js:224:26)

This current application contains a .npmrc file but I also have it in my users folder. I thought there may be a conflict there but it doesn't seem to be the case. How do I resolve this?

I am not really sure that it will fix it, but try running ADO_NPM_PAT='path/to/npm-binary' && npm i. See if the error changes.TheWhiteFang