我使用cpan在Yosemite上安装MongoDB。我的步骤:
sudo -s
Password:
bash-3.2# cpan
...
cpan[1]> install MongoDB
Running install for module 'MongoDB'
Running make for M/MO/MONGODB/MongoDB-v0.708.4.0.tar.gz
...
Running make install
Manifying 24 pod documents
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /Users/gerd/perl5/lib/perl5/darwin-thread-multi-2level/auto/MongoDB/MongoDB.bundle
Installing /Users/gerd/perl5/lib/perl5/darwin-thread-multi-2level/MongoDB.pm
Installing /Users/gerd/perl5/lib/perl5/darwin-thread-multi-2level/MongoDB/_Types.pm
...
Installing /Users/gerd/perl5/man/man3/MongoDB::Timestamp.3pm
Installing /Users/gerd/perl5/man/man3/MongoDB::Tutorial.3pm
Installing /Users/gerd/perl5/man/man3/MongoDB::WriteResult.3pm
Appending installation info to /Users/gerd/perl5/lib/perl5/darwin-thread-multi-2level/perllocal.pod
MONGODB/MongoDB-v0.708.4.0.tar.gz
/usr/bin/make install -- OK
cpan[2]>
退出cpan后,我测试了我的安装:
perl -e'use MongoDB; print MongoDB::VERSION();'
Can't locate MongoDB.pm in @INC (you may need to install the MongoDB module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
我认为问题是我的HOME目录/Users/gerd/perl5/lib/perl5/darwin-thread-multi-2level/MongoDB.pm中的模块位置。但是我在mac上的cpan安装过程中的错误在哪里?