设置Ruby开发环境时出错:找不到nodejs,无法连接到服务器

时间:2019-12-19 23:58:05

标签: node.js ruby development-environment

我是一位培训中的新开发人员,试图在使用Ubuntu的Windows计算机上设置我的Ruby开发环境。我正在按照这里的说明进行操作:

https://gorails.com/setup/windows/10

我已进入流程的最后几个步骤,这是我开始出现错误的地方:

# Navigate to the C: drive on Windows. Do this every time you open the Linux console.
cd /mnt/c

# Create a code directory at C:\code for your Rails apps to live (You only need to do this once)
mkdir -p code

#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql

#### or if you want to use SQLite (not recommended)
# rails new myapp

#### Or if you want to use MySQL
# rails new myapp -d mysql

# Then, move into the application directory
cd myapp

# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified

# Create the database
rake db:create

rails server

设置Postgres的步骤:

 rails new myapp -d postgresql

我收到有关设置nodejs的错误:

/home/event/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/event/.rbenv/versions/2.6.5 in PATH, mode 040777
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/

即使我转到提供的URL并安装NodeJS,当我尝试重复该过程时,仍然会显示该错误。这仅仅是问题所在吗?我需要重新安置它吗?

此外,尽管有该错误,我仍尝试执行其他步骤。当我输入此命令时,上面引用的文章中的倒数第二个:

rake db:create

我收到此错误:

could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create 'myapp_development' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


Caused by:
PG::ConnectionBad: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Tasks: TOP => db:create
(See full trace by running task with --trace)

我一直在搜索此问题,但收效甚微,并试图解释错误消息的含义;但以我目前的知识水平,这似乎超出了我。感谢任何人必须分享的见解!

0 个答案:

没有答案