简体   繁体   English

捆绑安装:权限被拒绝

[英]Bundle install: permission denied

Context : Trying to learn rails/ruby. 上下文 :尝试学习rails / ruby​​。 used the bitnami ubuntu ruby stack VM (2.1) as development environment. 使用bitnami ubuntu红宝石堆栈VM(2.1)作为开发环境。 its a preinstalled VM that is detailed here . 它是预安装的VM, 在此处进行了详细介绍。

Problem : Making a new project: rails new tp Which will automatically run bundle install, which fails 问题 :制作新项目: rails new tp它将自动运行捆绑软件安装,但失败

Installing sqlite3 (1.3.8) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /opt/bitnami/ruby/bin/ruby extconf.rb --with-sqlite3-dir=/opt/bitnami/sqlite 
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile

make "DESTDIR="
compiling database.c
compiling backup.c
compiling sqlite3.c
compiling statement.c
compiling exception.c
linking shared-object sqlite3/sqlite3_native.so

make "DESTDIR=" install
/bin/mkdir: cannot create directory `/opt/bitnami/ruby/lib/ruby/site_ruby/2.1.0/x86_64-linux/sqlite3': Permission denied
make: *** [.RUBYARCHDIR.-.sqlite3.time] Error 1


Gem files will remain installed in /home/bitnami/.bundler/tmp/3622/gems/sqlite3-1.3.8 for inspection.
Results logged to /home/bitnami/.bundler/tmp/3622/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.

Of course it fails with a permission denied because those gems are in directories managed by root and as the developer I create files and do my stuff as the regular bitnami user, of course. 当然,它会失败并拒绝权限,因为这些gems在由root管理的目录中,并且作为开发人员,我创建文件并以普通bitnami用户的身份进行操作。 That includes using the rails program and using said program through an IDE. 这包括使用rails程序以及通过IDE使用所述程序。 These assumptions seem clearly at odds with how the rubystack is set up or supposed to be used. 这些假设与rubystack的设置或使用方式显然不符。

Questions : 问题
-If my methods differ from the methods assumed by the stack, then what IS the assumed method? -如果我的方法不同于堆栈假定的方法,那么假定的方法是什么?
-If they dont differ, why is making a new project doing administration stuff? -如果他们没有不同,为什么要制作一个新项目来做管理工作?
-How should I go about making this thing work at all? -我应该如何使这件事完全起作用?

Please make sure the: 请确保:

ls -l /opt/bitnami/ruby/lib/ruby/site_ruby/2.1.0/x86_64-linux/

say that the folder belongs to you, not to root:root . 说该文件夹属于您,而不是root:root If the rights are for user, you can't create the folder, so to fix it just do: 如果权限是用户,则无法创建该文件夹,因此要解决此问题,请执行以下操作:

sudo chown bitnami:bitnami /home/bitnami/. -R

I strongly advice you to use and in order to not using the operations. 我强烈建议您使用 ,以便不使用操作。 Do as follows: 进行如下操作:

  1. In order to use the system ruby with just pickup it by execution: 为了在使用系统ruby ,只需执行以下命令即可:

     rvm mount /path/to/system/ruby 
  2. Then create a gemset: 然后创建一个宝石集:

     rvm gemset create bitnami 
  3. And use it: 并使用它:

     rvm gemset use bitnami 
  4. Update or install all gems into the specified gemset, but don't use for the action, just: 将所有gem更新或安装到指定的gemset中,但不要使用进行操作,只需:

     bundle install 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM