Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with npm install #4

Open
AlokBansal8 opened this issue Jul 12, 2017 · 4 comments
Open

Issue with npm install #4

AlokBansal8 opened this issue Jul 12, 2017 · 4 comments

Comments

@AlokBansal8
Copy link

Getting following error:

module.js:487
    throw err;
    ^

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
Exited with code 1

CircleCI config file:

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:latest

    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: update-npm
          command: 'sudo npm install -g npm@latest'

      - restore_cache:
          key: v0-dependencies-{{ checksum "package.json" }}

      - run:
          name: install-npm-packages
          command: 'npm install'

      - save_cache:
          paths:
            - ./node_modules
          key: v0-dependencies-{{ checksum "package.json" }}

      - run:
          name: test
          command: |
            echo Running Tests
            npm run test

      - store_artifacts:
          path: test-results.xml
          prefix: tests

      - store_artifacts:
          path: coverage
          prefix: coverage

      - store_test_results:
          path: test-results.xml
@cmalard
Copy link

cmalard commented Jul 25, 2017

It depends on Node image version :

  • no error: 4.*
  • Error: Cannot find module 'semver' : >4

Same thing with offical Node images.

This is an NPM issue : npm/npm#16807, npm/npm#15558, nodejs/docker-node#449

Simple workaround is to use latest Node image with latest NPM and not update NPM manually.

@surfjedi
Copy link

Are you sure you have semver in your package.json?

@jaydev
Copy link

jaydev commented Aug 27, 2018

This is what worked for me for the update-npm step in config.yml:

yarn global add npm@latest

@edisoncast
Copy link

This is what worked for me for the update-npm step in config.yml:

yarn global add npm@latest

I have used your command but npm version is not latest, I added this step in circle to verify.
- run:
name: Check npm and node version
command: |
node --version
npm --version

The output was 5.5.1. Currently the latest version is 6.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants