Unable to npm install private npm module using ciricleci 2.0

I have this step defined in my test job in circleci 2.0

      - image: buildpack-deps:trusty
      - checkout
      - run:
          name: npm secret
          command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

I have ssh’d to the container and verified that the .npmrc is properly created.

However, npm install still fails with

npm ERR! 404 'myprivatemodule' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404

npm works without issue in circleci 1.0

Any way to resolve this issue?

(Aside: would you edit your above log file to be code formatted please? If there are YAML errors, readers will not spot them unless it is correctly preformatted. Thank you).