Closed Post Followup - Exit Code 127

Hello:

I am following up on the closed post ‘wp-scripts’ error when using site shell FOLLOWUP

The solution of running ’ export NODE_ENV=development’ in the CLI did resolve the issue for me at this moment.

As is in so many forum posts I am looking for a followup:

  1. Why does switching environments work?
  2. Why is switching environments necessary?
  3. Is this just related to the LocalWP instance or does this issue occur for wp-env users?
  4. What is the difference between the NODE_ENV of production and development?
  5. Are there are any issues or pitfalls to watch out for?
  6. Is there a way to get the CLI command of NPX to work in production without errors?

Best,
Richard

As the user noted in the post you linked above @richardkrone , it looks like other WordPress contributors and devs had discussions about this previously both in Github and the WordPress slack. You might find some more answers and discussion in those areas, but I can have our team take a look and see if there is anything else we can help shed light on.