Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

bug: -c errors if no package.json in CWD or in parent directories #72

Closed
junosuarez opened this issue Jul 11, 2017 · 0 comments
Closed
Labels

Comments

@junosuarez
Copy link

reproduction:

in a blank directory without a package.json

> ls -a
./  ../
> npx -p cowsay -c "cowsay hi"
Command failed: /usr/local/lib/node_modules/npm/bin/npm-cli.js run env --parseable
npm ERR! path /Users/jsn/foo/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/jsn/foo/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jsn/.npm/_logs/2017-07-11T23_20_09_939Z-debug.log

> echo {} > package.json
> ls -a
./    ../   package.json
> npx -p cowsay -c "cowsay hi"
npx: installed 1 in 2.809s
 ____
< hi >
 ----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
>

note, if there is a package.json in one of the parent directories (regardless of contents as long as it's valid json), it also lets npx -c... proceed normally

expected

npx -c would shell exec a string even without a package.json present

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants