NPM error on Mac OS X 10.5 - node.js

I've to work for a project on Mac. But i've some problems for install nodejs.
When i make node -v on the terminal it's ok but when i wan't to use the command npm that doesn't work, i've this error:
npm -v
dyld: lazy symbol binding failed: Symbol not found: __ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
Referenced from: /usr/local/bin/node
Expected in: /usr/lib/libstdc++.6.dylib
dyld: Symbol not found:
__ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l Referenced from: /usr/local/bin/node Expected in:
/usr/lib/libstdc++.6.dylib
Trace/BPT trap
So if anyone can help because i really don't know how to fix the problem...
Thank's

#Kreepz - I recently had some machine problems, had to use an old machine, and ran into the same issues. Fear not, there is a solution!
Before we get started, please make sure you have Xcode installed on the machine. The version needed is 3.1.4 - which can be downloaded for free by registering with Apple and searching for it in Apple's dev tools here
Secondly, to save us ALOT of headaches, we're going to use brew to install node. That said, OS X 10.5.x does not support homebrew, but it does support tigerbrew.
To install tigerbrew, enter the following from your command line:
ruby -e "$(curl -fsSkL raw.github.com/mistydemeo/tigerbrew/go/install)"
Next, run the following to make sure brew is up to speed:
brew doctor
After running brew doctor you'll need to pay attention to the output closely. It's going to let you know about issues that must be resolved in your system. Address them and run brew doctor again until things look good.
Then, we'll need to make sure we can compile everything without hiccups. Before installing node, run the following:
brew install gcc48
Woop woop! Now what's next? You guessed it - let's install node:
brew install node
Now, that last command is going to take a while. If it fails, run brew doctor again and make sure all the warnings and errors are resolved. If you're still having issues, check the tigerbrew troubleshooting page here.
I hope that this helps you or anyone else looking at this! Good luck!

Related

Trying to install NodeJS on older mac

I'm using homebrew to install a few REPLs. I already succeeded with Ruby/irb, but now, when I try to install the javascript REPL with brew install node I get an error message. Then when I try to run node in terminal, I get the -bash: node: command not found.
I've tried searching for the relevant versions of nodejs for High Sierra, hoping I'd find which version worked with that specific OS, but no luck. I did find that I can input brew search node to get a list of available node versions, but I still don't know which one, and I don't want to make a serious mistake and fudge my system. Does anyone have a solution/suggestion?

Truffle failing to install on a Mac M1

I am trying to install Truffle on my mac M1.
I started by following the instructions on the truffle web site in the Pet Shop tutorial I got node installed node successfully, but then I get this error...
sudo npm install -g truffle
...
npm ERR! xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).
I did a bit of research and was pointed at trying it in homebrew instead. I had to update homebrew first because of my M1 chip, which I did successfully. But I still get what appears to be the same or similar error...
/opt/homebrew/bin/brew install truffle
...
xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).
truffle: The x86_64 architecture is required for this software.
I can't find out much about this online.
Does this mean that truffle only runs on intel chips and I need to use something like rosetta?
OK, so I finally figured this out and thought I would post here for posterity.
The issue was the version of the xcode command line tools that I had installed on my M1 Mac. I have no idea how, but it was an out of date version. The fix was to remove the command line tools and reinstall them. I think (I cannot say for certain) that this replaced them with M1/Arm versions and then the compile tools needed were in place.
To update I followed the steps in this Apple Developer Forum post
https://developer.apple.com/forums/thread/694283
Basically...
junk the existing folder
sudo rm -rf /Library/Developer/CommandLineTools
re-install
sudo Xcode-select --install
After doing this I re-ran
sudo npm install -g truffle
and it completed successfully (albeit with a bunch of audit warnings)

Why npm install speed so slow?

i am using mac book pro - M1 chip and bigsur
but I have a problem.
the speed so slow when i install any library to npm
please click the picture i have counted
the picture, i had install the 'react-native-fast-image'
but there consumes more 1000s for installed
likewise,
i had typed in terminal, 'npm i or yarn install'
Consumes more than 30 minutes.
for solving this, i have tried deleted xcode, and webstrom, and vsc
but, there are no change in speed.
I had this exact same issue. After speaking with Genius Bar we realised I was on an old version 12 of node. Node 15.5 onwards runs natively on M1 so isn't being parsed through Rosetta 2, which was likely causing the lag.
You can check the version of node you're on by running node -v
If you're on anything below 15, if you run nvm install v15 on terminal this might solve your issue by updating your node.
I had an error at this point (you might not) saying:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Which was solved with this.
After sorting that, when running nvm install v15 it solved the lagginess :) good luck!
You might also find even after installing the latest node, your terminal defaults to an old version (mine did to much bemusement!)
You can solve it be setting a default, check this link.
In short, run:
nvm use node
This switches to the latest installed version of node.
Today I used for the first time Node/NPM 17 and I got back to these issues of NPM install taking forever.
I switched back to Node/NPM 14 and everything works again just fine.
For those who cannot move their project to node 15 overnight.
Install node by itself by going on nodejs.org reduce drastically npm library installation on mac book pro - M1 Pro Monterey.

I have a lot of broken Homebrew symlinks, what do I do?

I installed node through homebrew 8 months ago.
I just tried to upgrade node through homebrew and it didnt work.
Instead, I got some message that encouraged me to run a line of code to fix it (I forget the code) but I think it broke my npm instead because my npm stopped working and I now get the error: zsh: command not found: npm when running any npm command.
I proceeded to completely uninstall node with this guide
I then began to reinstall node through homebrew with this guide
When I ran brew doctor I found that I have a lot of broken symlinks, including many npm files such as:
/usr/local/share/man/man1/npm-README.1
/usr/local/share/man/man1/npm-access.1
/usr/local/share/man/man1/npm-adduser.1
(along with about 60 other npm files and other fils including):
/usr/local/bin/grunt
/usr/local/bin/gulp
Where do I go from here? I simply want to reinstall node and npm through homebrew so that they work properly. Should I remove the broken symlinks with brew prune: or will that cause more problems for me? Thank you.
brew prune is meant for this. You can also dry run it to see what will be removed with the --dry-run flag.
prune [--dry-run]
Remove dead symlinks from the Homebrew prefix. This is generally not needed, but can be useful when doing DIY installations. Also remove broken app
symlinks from /Applications and ~/Applications that were previously created by brew linkapps.
If --dry-run or -n is passed, show what would be removed, but do not actually remove anything.
If you end up here because on the other way around you have a package installed with brew whose link seemed to disappear, relink like this:
brew unlink [package] && brew link [package]

Homebrew does not think XCode is installed with old XCode and current Homebrew

I am trying to install node.js but am still running OSX 10.6.8, and thus am stuck with XCode 3 (using 3.2).
My first issue, is that I cannot get homebrew to recognize XCode 3.2. When I run brew -v doctor I get the following output (after fixing a few other issues):
Homebrew 0.9.4
Warning: Setting DYLD_* vars can break dynamic linking.
Set variables:
DYLD_LIBRARY_PATH
Warning: Xcode not installed
Most stuff needs Xcode to build: http://developer.apple.com/xcode/
I have only been able to find fixes for XCode 4.xx and they have not worked for me. How do I point homebrew at my XCode? (I also don't really understand how I should set DYLD_LIBRARY_PATH...)
When I run brew install node I am told that xcode is not installed (it definitely is), and also this error: IOError: [Errno 2] No such file or directory: 'out/Release/node'
The fixes I have seen for this relate to XCode (various xcode-select -switch fixes), but they have not worked for me, as these fixes have been for XCode 4.xx.
When I run the verbose version, this error additionally shows up:
creating ./config.gypi
creating ./config.mk
sh: /usr/bin/usr/bin/xcodebuild: No such file or directory
/usr/bin/usr/bin/xcodebuild fails with 32512 - Unknown error: 32512
gyp: Error 69 running xcodebuild
I would really appreciate some help with this.
Thanks for reading.
While homebrew is great for a lot of packages I have never had good luck using it for node.js. Can you install using the standard OSX binary?
Also nvm is really good if you need to work with multiple versions of node.js
It sounds like you might now have the Xcode CLI tools installed. You can install them from the Xcode preferences.

Resources