0

I am developing a custom pipeline task for Azure DevOps to extend commit lint's functionality. All source files (and node modules) have been packaged inside the .vsix file. However when running the task in a pipeline it returns the following error as it is looking in the global node_modules.

My question is: How can I ensure the extension searches for the dependency locally not the global directory, also I'm not sure if the error lies in vss-extension.json or the file that is importing the package.

The error:

##[error]Cannot find module "/usr/local/lib/node_modules/@commitlint/config-conventional/lib/index.js" from "/home/vsts/work/1/s"

The files section of vss-extension.json

"files": [
    {
      "path": "BuildTasks/CommitCheck"
    },
    {
      "path": "BuildTasks/CommitCheck/v1/node_modules",
      "packagePath": "BuildTasks/CommitCheck/v1/node_modules",
      "addressable": true
    }
  ],

The file that is causing the error to occur:

export const configuration = {
    extends: ['@commitlint/config-conventional/lib/index.js'],
    parserPreset: {
        parserOpts: {
            headerPattern: /^(chore|fix|feat|docs|ci)\((\w+-?[0-9]*)\): (\w[^\n\s]+ [^\n]+)/,
            headerCorrespondence: ['type', 'ticket', 'subject'],
        },
    },
    rules: {
        'subject-case': [0, 'never', 'subject-case'],
        'body-max-line-length': [0, 'always', 1000],
        'header-max-length': [0, 'always', 200],
    },
}
1
  • Your question is difficult to understand because it’s dependent on the file structure of your solution. The problem you are seeing is the node process isn’t finding the dependencies it needs so it is attempting to find the packages elsewhere. Commented Jan 14 at 15:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.