resolve: `npx resolve` errors
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_scriptcan 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
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 17 (7 by maintainers)
Commits related to this issue
- [Fix] fix `npx resolve` by handling symlinks (#315) Fixes #315 — committed to browserify/resolve by ljharb 10 months ago
- v1.22.5 - [Fix] fix `npx resolve` by handling symlinks (#315) - [Dev Deps] update `array.prototype.map` — committed to browserify/resolve by ljharb 10 months ago
- Merge tag 'v1.22.5' v1.22.5 - [Fix] fix `npx resolve` by handling symlinks (#315) - [Dev Deps] update `array.prototype.map` — committed to browserify/resolve by ljharb 10 months ago
- v2.0.0-next.5 Changes since v2.0.0-next.4: - [Fix] fix `npx resolve` by handling symlinks (#315) - [Fix] allow `npx resolve` to work (#316) - [Tests] rename innocent test project to avoid flawed ... — committed to browserify/resolve by ljharb 9 months ago
I proposed once, this mention was just to inform you about the state of that API. Thanks for helping me with the issues
Good luck
require.mainis deprecated and something that should never, ever have existed; i’m not going to use it.And to ensure it can’t be required/imported.
v1.22.5 is published.
There’ll be no need for that workaround; i’ll have a release cut momentarily.