在Mac上安装casperjs的困难
原标题:Difficulties installing casperjs on Mac
After days trying install casperjs on my Mac, i m asking some help. I first used "brew install" method and NPM, this is terminal s messages :
brew install casperjs
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
[...]
==> Updated Formulae
Updated 4842 formulae.
==> Renamed Formulae
[...]
==> Deleted Formulae
[...]
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Tapping homebrew/cask
[...]
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "casperjs".
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get its complete history, run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
So I tried installing with NPM
npm install casperjs -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
Thank you in advance,
最佳回答
An edit three years later: if anyone comes across this, I really like mise right now! It s a polyglot version manager, so it works for basically every language, and I switched to it after using asdf for a while. Here s the website.
tl;dr: you should probably try a version manager like nodenv
You re right, brew.sh doesn t list any casper.js formulae; I m not sure why Casper lists it as an installation option in their docs. You could indeed install it using npm and sudo, but a better way to get started is to use a version/environment manager, like nodenv: it allows easy switching of Node.js versions globally, per-project based on a node-version file, or per-shell with an environment variable. Perhaps more importantly, since it installs node modules into a version-specific folder within ~/.nodenv (where ~/ refers to your user/home folder), it doesn t require sudo, which is safer and just generally better practice. You can install nodenv with Homebrew, too, which is nice. There are also other version managers, like NVM and n — I tried them both, but I found nvm to slow down shell startup far too much, and n doesn t allow per-project switching, and on top of all of that I just like the way nodenv works. For a different approach to version management, there s asdf, which is a language-agnostic version manager (though I haven t tried it). Any of them should solve the issue, though.
Also, I m not sure if you installed Node with Homebrew with the intent of using it for development, but if so, that s probably not the greatest idea either — lots of other Homebrew formulae depend on Node, and when you run brew upgrade to update your packages, there s always a possibility that you wind up unwittingly upgrading Node as a dependency of another formula, which would likely break something you ve done or some npm module(s). Basically, it s the same general concept as this blog post about why not to use Homebrew s Python, but with Node.
Hopefully that s helpful!
问题回答
Try it with sudo access. Then the error message say, that you don t have permission to write the npm-packages to the folder note-modules.
With sudo you can become temporarily root-access to install, remove or change any piece of software.
sudo npm i casperjs -g
相关问题
How use Instruments and display the console in Command Lines applications [duplicate]
I m using Xcode on OSX to develop command line C applications. I would also like to use Instruments to profile and find memory leaks.
However, I couldn t find a way to display the console when ...
2 mysql instances in MAC
i recently switched to mac. first and foremost i installed xampp.
then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL.
now the seperate mysql installation is ...
Iterating over string/strlen with umlauted characters
This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...
Controlling OSX windows
I m trying to control windows of a foreign OSX applications from my application. I d like
to
1. move the windows on the screen
2. resize the windows on the screen
3. change the currently active window ...
Switching J2SE versions on Mac OS (SnowLeopard)
My current JDK on Mac OS (10.6) is set to 1.6 and I d like to switch to 1.5.
A listing of /System/Library/Frameworks/JavaVM.framework/Versions/ shows:
lrwxr-xr-x 1 root wheel 10 Nov 3 18:34 ...
Scrolling inside Vim in Mac s Terminal
I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this.
Before ...
Is there a way to hook in to OSX sleep/wake events via Applescript?
The problem I am trying to solve is quite simple.
When I open the lid of my MacBook I like to have the Dock on the left side of the screen, but when I get home and connect my MacBook to my Cinema ...
export to MP3 from quicktime API
A question for Apple,QT programmers.
Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...