semantic-release / changelog

:blue_book: semantic-release plugin to create or update a changelog file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in Travis CI: cannot find module '@semantic-release/changelog'

talohana opened this issue · comments

Maybe I am missing something, but in my library: https://github.com/talohana/ngx-storage-api I am using semantic-release.
I added @semantic-release/changelog just as described in the docs, locally the dry-run runs correctly but in the CI (travis-ci) environment I get:

An error occurred while running semantic-release: Error: Cannot find module '@semantic-release/changelog'
Require stack:
- /home/travis/build/talohana/ngx-storage-api/noop.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at resolveFileName (/home/travis/build/talohana/ngx-storage-api/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/home/travis/build/talohana/ngx-storage-api/node_modules/resolve-from/index.js:43:9)
    at module.exports (/home/travis/build/talohana/ngx-storage-api/node_modules/resolve-from/index.js:46:47)
    at loadPlugin (/home/travis/build/talohana/ngx-storage-api/node_modules/semantic-release/lib/plugins/utils.js:51:82)
    at /home/travis/build/talohana/ngx-storage-api/node_modules/semantic-release/lib/plugins/index.js:17:37
    at Array.reduce (<anonymous>)
    at module.exports (/home/travis/build/talohana/ngx-storage-api/node_modules/semantic-release/lib/plugins/index.js:14:34)
    at module.exports (/home/travis/build/talohana/ngx-storage-api/node_modules/semantic-release/lib/get-config.js:92:35)
    at async module.exports (/home/travis/build/talohana/ngx-storage-api/node_modules/semantic-release/index.js:257:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/travis/build/talohana/ngx-storage-api/noop.js' ]
}

Relevant files:

release.config.js:

module.exports = {
  plugins: [
    '@semantic-release/commit-analyzer',
    '@semantic-release/release-notes-generator',
    '@semantic-release/changelog',
    '@semantic-release/git',
    [
      '@semantic-release/npm',
      {
        pkgRoot: 'dist/ngx-storage-api',
      },
    ],
  ],
};

.travis.yml:

language: node_js

node_js:
  - lts/*

notifications:
  email:
    on_success: never
    on_failure: always

install:
  - npm install -g codecov

script:
  - npm run test:ci
  - codecov
  - npm run package

jobs:
  include:
    # Define the release stage that runs semantic-release
    - stage: release
      node_js: lts/*
      # Advanced: optionally overwrite your default `script` step to skip the tests
      # script: skip
      deploy:
        provider: script
        skip_cleanup: true
        script:
          - npx semantic-release

package.json:

{
  "name": "ngx-storage-api",
  "version": "0.0.0-development",
  "private": true,
  "scripts": {
    "ng": "ng",
    "commit": "git-cz",
    "start:app": "ng serve ngx-storage-api-app",
    "test": "jest --config jest.config.js",
    "test:watch": "jest --config jest.config.js --watch",
    "test:ci": "jest --config jest.config.js --runInBand",
    "lint": "eslint . --ext .js,.ts",
    "lint:fix": "npm run lint -- --fix",
    "prettier": "prettier --write",
    "build:lib": "ng build --prod ngx-storage-api",
    "copy-files": "cp -t dist/ngx-storage-api README.md LICENSE",
    "package": "run-s clean build:lib copy-files",
    "clean": "rimraf dist",
    "semantic-release": "semantic-release"
  },
  "config": {
    "commitizen": {
      "path": "cz-conventional-changelog"
    }
  },
  "dependencies": {
    "@angular/animations": "~10.1.1",
    "@angular/common": "~10.1.1",
    "@angular/compiler": "~10.1.1",
    "@angular/core": "~10.1.1",
    "@angular/forms": "~10.1.1",
    "@angular/platform-browser": "~10.1.1",
    "@angular/platform-browser-dynamic": "~10.1.1",
    "@angular/router": "~10.1.1",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1001.1",
    "@angular/cli": "~10.1.1",
    "@angular/compiler-cli": "~10.1.1",
    "@commitlint/cli": "^9.1.2",
    "@commitlint/config-conventional": "^9.1.2",
    "@semantic-release/changelog": "^5.0.1",
    "@semantic-release/git": "^9.0.0",
    "@types/jest": "^26.0.13",
    "@types/jest-when": "^2.7.1",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "^4.1.0",
    "@typescript-eslint/parser": "^4.1.0",
    "codelyzer": "^6.0.0",
    "commitizen": "^4.2.1",
    "eslint": "^7.8.1",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-prettier": "^3.1.4",
    "husky": "^4.3.0",
    "jest": "^26.4.2",
    "jest-marbles": "^2.5.1",
    "jest-preset-angular": "^8.3.1",
    "jest-when": "^2.7.2",
    "lint-staged": "^10.3.0",
    "ng-packagr": "^10.1.0",
    "npm-run-all": "^4.1.5",
    "prettier": "^2.1.1",
    "rimraf": "^3.0.2",
    "semantic-release": "^17.1.1",
    "ts-node": "~8.3.0",
    "typescript": "~4.0.2"
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
      "pre-commit": "lint-staged"
    }
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/talohana/ngx-storage-api.git"
  }
}

install:

  • npm install -g codecov

you've overridden the default install step in your travis config, meaning that your dependencies are not being installed. i'm guessing the ones that are available are from the cache of builds that ran before this change