Skip to content

npx resolve errors #315

Description

@vvscode

I have the error, so I added some debug info upfront:

console.log({
    npm_lifecycle_script: process.env.npm_lifecycle_script,
    _: process.env._,
    __filename
})

if (
    String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
    && (
        !process.argv
        || process.argv.length < 2
        || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
        || (process.env._ && path.resolve(process.env._) !== __filename)
    )
) {
    console.error('Error: `resolve` must be run directly as an executable');
    process.exit(1);
}

that gives me:

{
  npm_lifecycle_script: 'resolve',
  _: '/Users/v.vanchuk/repo/test/node_modules/.bin/resolve',
  __filename: '/Users/v.vanchuk/repo/test/node_modules/resolve/bin/resolve'
}

I failed to follow the logic in this place

  • when npm_lifecycle_script can have space at the end?
  • why in general you make this restriction? (what's the purpose?)

Hope you can help / clarify this moment =)

Thanks in advance

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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