You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

zsh - bash spawn bin/zsh ENOENT error

Hello!

I am having problems with npm packages installed on my MacOS big sur 11.6.3.

Each time I try to install an npm package using terminal on VSCode or Simple Terminal I have an installation fail with this output:


---------------------------------------------

npm ERR! code ELIFECYCLE

npm ERR! syscall spawn bin/zsh

npm ERR! file bin/zsh

npm ERR! path bin/zsh

npm ERR! errno -2

npm ERR! core-js-pure@3.20.3 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`

npm ERR! spawn bin/zsh ENOENT

npm ERR!

npm ERR! Failed at the core-js-pure@3.20.3 postinstall script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


I have tried different approaches to install the packages but with no success, not quite sure if it's a permission problem, or environment....not very well versed on these 2 topics.

But on my MacBook air running a late version of macOS I believe it's 10.11, no such problems exist....I have developed a complete application there using the same packages I am trying to install on my iMac.

Anyone come across this problem and can point me to a solution?


Many Thanks

R.V

iMac 27″ 5K, macOS 11.6

Posted on Jan 27, 2022 4:36 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 6, 2022 9:56 AM

Not many developers on these forums, you might be better suited asking at developer forums such as StackExchange, etc.


However, try an "npm cache clean -force" command inside your project directory. You might have copied over the hidden cache file with your project to the new Mac and it's causing issues due to version mismatches with Node.js, npm, etc. You might also need to remove the node_modules directory in your project as well as the package-lock.json file. Back them up and remove them. Run "npm install".

Similar questions

11 replies
Question marked as Top-ranking reply

Feb 6, 2022 9:56 AM in response to rvcore

Not many developers on these forums, you might be better suited asking at developer forums such as StackExchange, etc.


However, try an "npm cache clean -force" command inside your project directory. You might have copied over the hidden cache file with your project to the new Mac and it's causing issues due to version mismatches with Node.js, npm, etc. You might also need to remove the node_modules directory in your project as well as the package-lock.json file. Back them up and remove them. Run "npm install".

Feb 10, 2022 9:21 AM in response to rvcore

rvcore wrote:

Hello!
I am having problems with npm packages installed on my MacOS big sur 11.6.3.
Each time I try to install an npm package using terminal on VSCode or Simple Terminal I have an installation fail with this output:

---------------------------------------------
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn bin/zsh
npm ERR! file bin/zsh
npm ERR! path bin/zsh
npm ERR! errno -2
npm ERR! core-js-pure@3.20.3 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn bin/zsh ENOENT
npm ERR!
npm ERR! Failed at the core-js-pure@3.20.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I have tried different approaches to install the packages but with no success, not quite sure if it's a permission problem, or environment....not very well versed on these 2 topics.
But on my MacBook air running a late version of macOS I believe it's 10.11, no such problems exist....I have developed a complete application there using the same packages I am trying to install on my iMac.
Anyone come across this problem and can point me to a solution?

Many Thanks
R.V



Running Visual Studio Code on macOS


Node.js Tutorial for Beginners 3 - Install and Use Visual Studio ...


Feb 13, 2022 1:26 AM in response to leroydouglas

I have watched both videos you recommended, this only comes to reinforce that i am using everything correctly, as i mentioned all node js and respective components are working correctly with no errors on my macbook air running a early version of MacOS, also it was running great at some point on my IMac, after i updated it to Big Sur the problems with the bin/zsh started.

Thanks for your recommendations and reply.

Feb 15, 2022 7:47 AM in response to James Brickley

Hi again James,

The tip about creating a new user worked, i am able to install everything and work normally with Node and Npm with no problems, had only a permission situation on the install folders but took care of that with a new set of permissions using terminal, now the other challenge is to find the difference between my session and the new user session...I belive its because of the terminal environment settings, when i ECHO the shell on the new user session i created i get this result:


echo $SHELL..

-zsh


on my session:

echo $SHELL..

/bin/zsh


I am going to dig deeper on this so i can understand whats wrong and fix it. (have no idea where to start)

Thanks for the tip!

Feb 15, 2022 8:06 AM in response to rvcore

Well that's strange. My test user (super clean nothing configured) results in "/bin/zsh" with an "echo $SHELL".


But since everything is now working with a test account there is something wrong with your primary user and your environment, configuration, etc. I doubt it is the shell configuration. But you can compare the two user accounts by going to System Preferences -> Users & Groups, unlocking the screen and right-clicking each user and clicking on Advanced Options. You will see the home directory and login shell "/bin/zsh" would be the normal default.


It is most likely something else going on with your path or variables in your .zshrc, etc.

Feb 15, 2022 8:17 AM in response to James Brickley

That´s my next step, i think i haven't found a .zshrc in either the sessions, not sure, but i will investigate.

In my present session (the one giving the error) i only have a bash_profile file. Since i upgraded to Big Sur i believe that change was made to upgrade to zsh...a lot of maybes and if´s...

Definitely made a mistake configuring NODE and the environment permissions along the way... unfortunately i can´t retrace my steps, so i am going to compare the users accounts like you suggested. I will report my findings.


Many Thanks!

zsh - bash spawn bin/zsh ENOENT error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.