Have to use sudo while using node command in osx - macos

I just installed node.js in osx, finding that I have to use sudo before executing any node command, which causes big inconvenience. I think the problem is that my current system account does't have the permission to execute node command, which I guess could be resolved by authorisation. Yet, I don't know how to do it. Anyone knowing how to authorise? Thanks in advance!

Related

-Bash Shell Script "No such file or directory"

Pretty new to coding and I am running into an error I've never seen before and would really appreciate any help navigating this :( Thank you!
I wanted to delete nvm, so I removed the folder following the advice given on StackOverflow. That FINALLY successfully deleted node from my mac (wanted to uninstall because I was running into dependency errors). The I used brew install to reinstall node. I can find the path to the node file (using which node). However when I run node -v I get the following bash (shell script??) error: -bash: /Users/Cindy/.nvm/versions/node/v12.14.1/bin/node: No such file or directory
I also followed #1219 and went into my bash_profile to delete the lines related to nvm. Now I don't know how to move forward with this.
I just want to be able to download node and run it properly to prepare for an interview in React and JS but I ran into these nasty bugs instead and morale is low. I'm lost now and I'm not sure if I just completely ruined my computer.

MJML run and watch error

I'm following the tutorial on https://mjml.io/documentation/#basic-layout-example
And followed these instructions to install https://mjml.io/download
But whenever I want to use ./node_modules/.bin/mjml index.mjml or mjml index.mjml I get the following error:
Command 'sed' is available in '/bin/sed'
The command could not be located because '/bin' is not included in the
PATH environment variable.
sed: command not found
/usr/bin/env: 'node': No such file or directory
I have no idea what I'm doing wrong and Google hasn't been helpful so far.
Any idea why this is happening? Thanks for your time :(
Seems you have messed your PATH environment variable. The sed program is there as is part of the core packages. You can try to do something like the mentioned here.
Also try to reach the mjml support group in slack
I think you have not installed node properly. Try reinstalling it.
If you reinstalled the node and then also you are facing the problem then there is some problem with Windows because a few days ago I was facing a problem when I was running the npm run build command then I switch to my Virtual box Linux OS there it works fabulously.

Getting chef-client 11.14.6 for later MacOSX versions

I have inherited a cheffed OSX machine running chef-client 11.14.6. I am trying to lay my hands on the installer for 11.14.6, but it seems that Chef have pulled it from the downloads site ( https://downloads.chef.io/chef-client/mac/ ).
Does anyone know anything about this, or know where I can get "archived" version?
Much appreciated.
I don't see any copies in any repos so it's probably lost to the mists of time by now. You should be able to build a new one using this commit from omnibus-chef https://github.com/chef/omnibus-chef/tree/6d5001c588edacc98f6045e22c70195200111660
Yes. From my research, and the research of others. It seems as if it has been removed.
However, we (I can't take the credit - it was one of my colleagues :) ) managed to get it working. We had another machine with the correct version on it, so we grabbed it from there and zipped it up (using root as the base, and grabbing /opt/chef).
Once tarball (e.g. opt.chef-11.14.6.tar.gz) is transferred to new machine, these were the steps used:
install chef-client v11.10.4 using:
(echo "version=11.10.4"; curl -L https://www.opscode.com/chef/install.sh) | sudo bash
verify your chef-client version is currently reported as 11.10.4 with "chef-client -v"
extract the tarball as root into the root filesystem using:
cd / && tar xvfz /tmp/opt.chef-11.14.6.tar.gz
verify your chef-client version is now reported as 11.16.4 with "chef-client -v"
run your knife bootstrap command like normal, but don't include the --bootstrap-version parameter, it'll detect chef-client is already installed and use the one you have installed manually.
I did not try rebuilding it.

While installing cloud manager facing oracle-j2sdk1.7 installation failed

im trying to install cloud manager on ubuntu 12.04.
But im failed and below is the error :
oracle-j2sdk1.7 installation failed. See /var/log/cloudera-manager-installer/3.install-oracle-j2sdk1.7.log for details. Click OK to revert this installation.
Any help can be appricaited now.
Regards,
BJ
Looks like its some kind of lock already in place which might occur at login or because of the first attempt at the installation failing.
Try logging in, maybe even rebooting and trying again.
If this still fails, try the following:
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
This should force an update and recreate the directory correctly. There's a thread about this on the Ubuntu forums which might be more useful and provide a lot more information on this problem:
http://ubuntuforums.org/showthread.php?t=1986288
If this is still a problem. Provide the full stack trace/log that is mentioned in the error.
We can't blindly provide advice, we need the actual error from the log in order to help you.

"No such file or directory - getcwd" error on rubygems on Mac Os Lion

I'm trying to launch a heroku console that uses rubygems but I keep getting this error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:471:in `expand_path': No such file or directory - getcwd (Errno::ENOENT)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:471:in `find_files'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:470:in `map'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:470:in `find_files'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1103
from /usr/bin/heroku:9:in `require'
from /usr/bin/heroku:9
I'm using Mac OS Lion 10.7.3. Any ideas on how to fix this? Thanks!
Maybe the current working directory of the shell that's used to start your heroku process doesn't exist (maybe removed by another process, as in my case), and therefore getcwd throws an error.
This happened to me. It turned out I had deleted the folder I was running the command in.
I had that same issue.... running sudo gem update --system fixed the problem... give it a try.
I had the same thing, just type cd in the terminal, then navigate back to where you were and it works.
Tried starting the rails server in another console tab.
cd . solved it for me
Faced a similar issue while setting up rails app locally.
The issue was that the server was running in a directory which i had removed from another terminal window to recreate the app.
Close terminal and do it again or go to some other directory and come back and do it...
Anything should work..It did for me.
I encounter a same one, it happened when the working directory has actually been removed.
This doesn't appear to be Heroku issue as something in your code is requiring this getcwd.
What happens if you run this application locally in production mode? Have you defined all of your dependencies for Heroku (either via a .gems file or Bundler)
In my case, I was in a directory that had "unusual" characters in its name: /Volumes/Members/Finance & Accounting/-MC 2008, 7848/2020.
And also, I was in a remote directory, as Mac users will recognize.
I simply did push ~ and ran the command again, then did popd to get back to my remote directory with odd characters in the name.
It could be that gem is ill-behaved in the face of directory names containing whitespace, or it could be that it doesn't work on networked directories.
The bash built-in pwd worked just fine in the remote directory with the funny name.
This whole thing makes me a bit nervous about gem.
solved for me
cd ..
cd -
you have to go back and return to current directory.
Ended up on this page from searching for the same error on AWS Elastic beanstalk.
The problem with getcwd is because EB is trying to repeat the deployment process endlessly. It changes the /var/app/staging directory before it is able to finish the current action. getcwd fails because the directory was already replaced. Try deploying a stable version or a sample app
This just happened to me while I was running a Sinatra app on my localhost and this is what I found.
Scenario:
I'm using Git as my version control and I switched branches from development to master to merge my branches. After the merge, with an active server running, I made a minor html change which shouldn't have blown up the app and when I went to check the change in my broswer my "request" came back with OP's error - just to note this app isn't deployed to heroku.
My guess:
I'm not familiar with the intricacies of Webbrick (or equivalent programs) but I'm guessing you had an active server running (like me) and it was was looking for specific file(s) in memory and when they were modified on a possible branch change or an important file was modified/deleted - Webbrick freaked out and didn't know where to find it/them and threw up this error.
I'm not sure what version control you're using but I know git is popular for heroku so I think this might have something to do with your issue.
Fixing the issue for myself was as simple as restarting the server, hope this helps future trouble shooters.
I solved this problem by closing and restarting my terminal, setting the correct Ruby version in the new Terminal to
$ rvm use 2.1.1
(or whatever Ruby version is relevant to your program)
as explained by gerardk
you could try this before launching back heroku console
$ pwd #ie: /mywork
$ cd ..
$ cd [pwd] #ie: cd mywork
now go launch back heroku console
Restart system fixed this problem in my case
I worked around this error by shutting down the server, restarting my terminal, then restarting the server.
sudo gem update --system (as Israfil Havilah mentioned) and rebooting the server (Ubuntu 16.04.6 LTS) helped me
Make sure, you are not switching git branches. To me, it happened due to switching between GIT branches deleted my folder.

Resources