How to update npm to @latest with docker image circleci/node 8.6

nodejs
npm

#1

Hello there. What is the official way to update npm to @latest?

We currently do this to get it working. But this seems not straight forward:

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8.6
    steps:
      - run:
          name: "Update npm"
          command: |
            npm install npm@latest
            sudo rm -rf /usr/local/lib/node_modules/npm
            sudo mv node_modules/npm /usr/local/lib/node_modules/npm
            sudo chown -R 500:500 /usr/local/lib/node_modules/npm
      - run:
          name: "Checking Versions"
          command: |
            node --version
            npm --version

#2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.