Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

[BUG] Npx doesn't execute my scoped package and opens its bin file in my editor #44

Closed
Telokis opened this issue Mar 10, 2020 · 4 comments

Comments

@Telokis
Copy link

Telokis commented Mar 10, 2020

What / Why

I freshly published a binary tool to help me with my projects (https://www.npmjs.com/package/@telokys/easy-typescript).
The code source can be found there if need be.
I expected to be able to run npx @telokys/easy-typescript in order to easily run my bin without even installing it.
Instead of running my script, npx opens the build/src/bin.js file inside my VSCode without executing it.
It stills prints npx: installed 12 in 4.738s but doesn't execute anything.
I tried using npx -p @telokys/easy-typescript easy-typescript but the exact same behavior occurred.

npx works fine for anything else and I just updated it (using npm i -g npm@latest) to version 6.14.2.

As a side note, I also get an annoying error about rimraf:

npx: installed 12 in 4.738s

 C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:313
        throw er
        ^

Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Telokis\AppData\Roaming\npm-cache\_npx\1176\node_modules\@telokys\easy-typescript\build'
    at Object.rmdirSync (fs.js:769:3)
    at rmkidsSync (C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:356:25)
    at rmdirSync (C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:334:7)
    at rimrafSync (C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:304:9)
    at C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:342:5
    at Array.forEach (<anonymous>)
    at rmkidsSync (C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:341:26)
    at rmdirSync (C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:334:7)
    at rimrafSync (C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:304:9)
    at C:\Users\Telokis\AppData\Roaming\npm\node_modules\npm\node_modules\rimraf\rimraf.js:342:5 {
  errno: -4051,
  syscall: 'rmdir',
  code: 'ENOTEMPTY',
  path: 'C:\\Users\\Telokis\\AppData\\Roaming\\npm-cache\\_npx\\1176\\node_modules\\@telokys\\easy-typescript\\build'
}
@ljharb
Copy link

ljharb commented Mar 10, 2020

Perhaps that file doesn't have +x set on it? bin files need to be executable.

@Telokis
Copy link
Author

Telokis commented Mar 10, 2020

Oh I need to +x it before publishing to npm?

@ljharb
Copy link

ljharb commented Mar 10, 2020

You should anyways, for explicitness, altho i think npm will fix that for you when it's installed; but if you want it ran locally then you must.

@Telokis
Copy link
Author

Telokis commented Mar 11, 2020

Ok this was a very stupid issue on my end: I forgot to add a shebang to my bin file...

@Telokis Telokis closed this as completed Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants