我正在尝试学习创建Web应用程序,nodejs并expressjs按照快递网站上的入门指南,在使用快递(1)标题下生成应用程序.
我使用express-generator插件生成了一个应用程序,运行npm install,然后尝试运行应用程序node app(我也尝试node app.js了很好的措施.当运行这些命令中的任何一个时,终端都没有输出.
我还尝试使用node debug app以下结果调试应用程序:
< debugger listening on port 5858
connecting... ok
break in app.js:1
1 var express = require('express');
2 var http = require('http');
3 var path = require('path');
debug> cont
program terminated
debug> cont
App isn't running... Try `run` instead
debug>
Run Code Online (Sandbox Code Playgroud)
我确实找到了一个bin/www似乎包含启动服务器代码的文件,当然,运行node bin/www成功启动了应用程序.
我在这里错过了什么?
我正在尝试学习如何从我的模块中以编程方式创建自定义内容类型.
但是,卸载并重新安装我的模块后,我收到一条错误消息,指出我尝试创建的一个或多个字段无法创建,因为它们已经存在.
所以我破解了我的数据库,删除了内容类型和所有属于它的表.
相同的结果 - 字段已存在.
接下来,我访问了Drupal API网站,寻找删除字段和字段实例的方法,并且遇到了
field_delete_field()
Run Code Online (Sandbox Code Playgroud)
和
field_delete_instance()
Run Code Online (Sandbox Code Playgroud)
我创建了一个php页面来尝试删除我创建的字段,只是为了得到一个错误,指出我试图删除的表不存在.
所以我有点卡住 - 我不能创建字段,因为它们已经存在,我不能删除它们,因为它们不存在!
顺便说一句,我在为我的模块建模的代码是在Drupal 示例模块的"node_example"部分中找到的代码.
我试图在我的rails应用程序中,在Employee模型和NetworkDrive模型之间建立has_and_belongs_to_many关系.
在employee.rb我指定
has_and_belongs_to_many :network_drives</code>
Run Code Online (Sandbox Code Playgroud)
并在network_drive.rb中...
has_and_belongs_to_many :employee</code>
Run Code Online (Sandbox Code Playgroud)
但是,它似乎生成模型属性,如":network_drife_ids"而不是":network_drive_ids",它给我的错误像
uninitialized constant Employee::NetworkDrife
这是准确的,考虑到该模型被称为NetworkDrive,而不是NetworkDrife.
很抱歉,如果这是一个重复的问题,但我不知道如何搜索此问题.我在这里尝试了几个关于HABTM关系问题的解决方案,但无济于事.
更新:这是完整的错误,在尝试将其更改为has_many之后:通过关系.
NameError: uninitialized constant EmployeeItRequest::EmployeeItRequestDrife
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/inheritance.rb:111:in `compute_type'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/reflection.rb:172:in `klass'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/reflection.rb:216:in `association_primary_key'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/associations/has_many_association.rb:104:in `foreign_key_present?'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/associations/association.rb:165:in `find_target?'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/associations/collection_association.rb:332:in `load_target'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/associations/collection_proxy.rb:44:in `load_target'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/associations/collection_proxy.rb:87:in `method_missing'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.7/lib/rails/commands/console.rb:47:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.7/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.7/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Run Code Online (Sandbox Code Playgroud)
更新:NetworkDrive.tableize的结果
NoMethodError: undefined method `tableize' for #<Class:0x0000000229fef8>
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.7/lib/active_record/dynamic_matchers.rb:50:in `method_missing'
from (irb):1
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.7/lib/rails/commands/console.rb:47:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.7/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.7/lib/rails/commands.rb:41:in `<top (required)>' …Run Code Online (Sandbox Code Playgroud)