Node_modules not added to $PATH in terminal

Answered

I have a project structured like so:

deploy
sites (php sites)
nx (angular code)
|- node_modules

Now, when working with IntelliJ IDEA 2024.2, and opening a terminal, I expect that 

./nx/node_modules/.bin is added to the $PATH. 

As that works for all other projects. 

However, it isn't. The difference is that I don't have a package.json on root level. As soon as I add a package.json on root level, and I open a new terminal the node_modules `(also on root level) is added to my PATH.

To separate my ‘sites’ from my angular (javascript) code, (and future NestJS backend code, also javascript) I want to have the package.json in the NX folder

As a result, I can't run commands (like ‘nx’) on the command line.

0
3 comments

Indeed, this option only works if there is a package.json in the project root directory. If you miss a possibility to add node_modules/.bin from nested folders to $PATH for project structure like yours, please file a feature request to https://youtrack.jetbrains.com/issues/IJPL. We’ll see if it can be done.

0

I would consider this a bug and not an enhancement; in prior versions of IDEA, this used to work as expected. Only recently has this been an issue. I have a repo monolith with an Astro sub-project in a subdirectory and this was never a problem before.

0

Mel Llaguno Please feel free file an issue in https://youtrack.jetbrains.com/issues/IJPL with more details(screenshots and logs) and we'll check further from there.

0

Please sign in to leave a comment.