如何安装上OSX JSON.pm Perl模块,(How to install JSON.pm pe

2019-07-31 01:56发布

我试图使用po2json解析器/转换器从JS gettext库( http://jsgettext.berlios.de/ ),但是当我尝试将我得到这个错误:

Can't locate JSON.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at ./po2json line 23.
BEGIN failed--compilation aborted at ./po2json line 23.

据我了解我缺少一个Perl模块,即JSON.pm,一个我认为这是这一个: http://cpansearch.perl.org/src/MAKAMAKA/JSON-2.53/lib/JSON.pm

现在,我怎么在OSX安装? 我使用的山狮。

我试图做cpan install JSON ,但它不工作,我得到以下错误:

Writing Makefile for JSON
  MAKAMAKA/JSON-2.53.tar.gz
  make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

Answer 1:

输出表示, make没有成功返回。 可能是由于一些依赖性。 尝试使用cpanm http://search.cpan.org/~miyagawa/App-cpanminus-1.5017/bin/cpanm ,它是真正免费的麻烦和自举得很好(无需安装其他的东西)。

安装使用此:

curl -L http://cpanmin.us | perl - --sudo App::cpanminus



Answer 2:

使用自制安装cpanm:

brew install cpanm

然后你就可以安装使用JSON

sudo cpanm install JSON



Answer 3:

cpan install JSON具有JSON全部大写使得它为我工作。



Answer 4:

I know this is an old topic, but wanted to share my solution after finding that I needed JSON when trying to use zap2xml (perl based). I was getting the error: "Can't locate JSON.pm in @INC..." after installing perl via Homebrew.

This is how I installed JSON via Homebrew. I will also include the steps required to install Homebrew (for those who would like to know). ;)

Prerequisites:

Install Xcode from the App Store (Download):

https://itunes.apple.com/us/app/xcode/id497799835

Install Command Line Tools for Xcode (Run in Terminal):

xcode-select --install

Install Homebrew (Run in Terminal):

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew (Run in Terminal):

brew update

brew upgrade

brew doctor (correct issues found by brew doctor. Instructions will be given by The Doctor. :P)

Install cpanminus (Run in Terminal):

brew install cpanm

Check perl (Run in Terminal):

which perl

perl -V (with a capital -V)

Check/Install JSON module (Run in Terminal):

sudo cpanm -v JSON

DONE.



Answer 5:

以下为我工作:
在终端中运行:
sudo perl -MCPAN -e shell

你应该得到的CPAN shell提示符以下commond在CPAN shell中运行:

cpan[1]> install JSON

问候,
阿南德Choubey



Answer 6:

这种方式是确定的,具体情况如下命令: sudo apt-get install libjson-perl



文章来源: How to install JSON.pm perl module on OSX