Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

npm run something miss setting the cwd when running the command in a project sub-folder. #12164

@xieranmaya

Description

@xieranmaya

For example I have a project which installed a babel-cli locally, and added a script entry in the package.json to run babel by npm run, then I cd to a sub-folder(i.e. /foo/ folder) of my project and run npm run babel a.jsx -o a.js, the script will fail by not found the file a.jsx.

I should run the command npm run foo/a.jsx -o foo/a.js for the right behavior.

Which means npm run sets the cwd to the project root path but not the path which running the command, I think that is not an expected behavior, cause git(or most other command) will setting the correct cwd when you run git command in sub-folder of a repo:

/foo/ > git add a.js will work, not need to run git add foo/a.js(and in fact this command will fail)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions