Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-14869

Account level variable isn't resolved

    XMLWordPrintable

Details

    Description

      So I followed the docs for adding the .npmrc file so the script can auto publish to the NPM registry.

      When I add the NPM_TOKEN to the repository, this works fine.
      But when I add it to my personal Bitbucket settings > Pipelines > Environment variables (and delete it from the repository), I get an error

      
      + npm install
      Error: Failed to replace env in config: ${NPM_TOKEN}
          at /usr/local/lib/node_modules/npm/lib/config/core.js:418:13
          at RegExp.[Symbol.replace] (native)
          at RegExp.[Symbol.replace] (native)
          at String.replace (native)
          at envReplace (/usr/local/lib/node_modules/npm/lib/config/core.js:414:12)
          at parseField (/usr/local/lib/node_modules/npm/lib/config/core.js:392:7)
          at /usr/local/lib/node_modules/npm/lib/config/core.js:335:17
          at Array.forEach (native)
          at Conf.add (/usr/local/lib/node_modules/npm/lib/config/core.js:334:23)
          at ConfigChain.addString (/usr/local/lib/node_modules/npm/node_modules/config-chain/index.js:244:8)
      /usr/local/lib/node_modules/npm/lib/npm.js:39
            throw new Error('npm.load() required')
            ^
      Error: npm.load() required
          at Object.get (/usr/local/lib/node_modules/npm/lib/npm.js:39:13)
          at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:60:40)
          at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:180:3)
          at emitOne (events.js:96:13)
          at process.emit (events.js:188:7)
          at processEmit (/usr/local/lib/node_modules/npm/node_modules/npmlog/node_modules/gauge/node_modules/signal-exit/index.js:146:32)
          at processEmit [as emit] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/signal-exit/index.js:146:32)
          at process._fatalException (bootstrap_node.js:296:26)
      

      Maybe this has something to do with the fact that I couldn't see the Pipelines > Environment variables in my Bitbucket settings until I created a test-repo with a pipeline and clicked on the View account variables link?

      Attachments

        Activity

          People

            Unassigned Unassigned
            171d3afa8149 MichaelDeBoeyIxor
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: