Skip to content

Failed step "prepare" of plugin "@semantic-release/npm" due to reading malformed path #773

@joshunrau

Description

@joshunrau

Recently, when running semantic-release on GitHub Actions this plugin is causing an error due to trying reading a path that doesn't make any sense. From what I can tell, it seems to be reading input from stdout of other commands and inserting it into the path.

I have been experimenting on a package I created to setup semantic-release for other packages, so all of the errors and code are public.

As you can see in this workflow run, this is the error that is occurring:

[6:00:22 PM] [semantic-release] [@semantic-release/npm] › ℹ  Creating npm package version 0.1.2

> @joshunrau/[email protected] prepare
> husky

npm notice 
npm notice 📦  @joshunrau/[email protected]
npm notice === Tarball Contents === 
npm notice 1.1kB LICENSE       
npm notice 1.8kB README.md     
npm notice 95B   bin/cli.js    
npm notice 1.8kB package.json  
npm notice 82B   src/index.d.ts
npm notice 786B  src/index.js  
npm notice === Tarball Details === 
npm notice name:          @joshunrau/semantic-release             
npm notice version:       0.1.2                                   
npm notice filename:      joshunrau-semantic-release-0.1.2.tgz    
npm notice package size:  2.6 kB                                  
npm notice unpacked size: 5.7 kB                                  
npm notice shasum:        3383e03fb545881b87b2414fce8c9be5b5d66173
npm notice integrity:     sha512-Um1jZMbnodS0q[...]14WuidIyC/aow==
npm notice total files:   6                                       
npm notice 
HUSKY=0 skip installjoshunrau-semantic-release-0.1.2.tgz
[6:00:24 PM] [semantic-release] › ✘  Failed step "prepare" of plugin "@semantic-release/npm"
[6:00:24 PM] [semantic-release] › ✘  An error occurred while running semantic-release: [Error: ENOENT: no such file or directory, lstat '/home/runner/work/semantic-release/semantic-release/HUSKY=0 skip installjoshunrau-semantic-release-0.1.2.tgz'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/home/runner/work/semantic-release/semantic-release/HUSKY=0 skip installjoshunrau-semantic-release-0.1.2.tgz',
  pluginName: '@semantic-release/npm'
}
[Error: ENOENT: no such file or directory, lstat '/home/runner/work/semantic-release/semantic-release/HUSKY=0 skip installjoshunrau-semantic-release-0.1.2.tgz'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/home/runner/work/semantic-release/semantic-release/HUSKY=0 skip installjoshunrau-semantic-release-0.1.2.tgz',
  pluginName: '@semantic-release/npm'
}

I need to set HUSKY = 0 in the environment to prevent commitlint from blocking my release due to lengthy commit messages generated by other plugins.

If I remove the { prepare: "husky" } script from my package.json, the problem doesn't occur. However, last week it was working with the same command and versions. Also, when I run semantic-release with the --debug flag, the problem doesn't occur.

Any help would be appreciated.

Thanks

EDIT: Actually, on my eslint-config repo, the same error occurred with the --debug flag (see https://github.com/joshunrau/eslint-config/actions/runs/8590757046/job/23538694193).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions