我按照快速入门指南进行操作。现在我试图返回一些超级简单的 JSON,但文档是错误的,并且无法在不进入 IRC 的情况下提交票证。
error[E0432]: unresolved import `rocket::serde::json`
--> src/main.rs:2:20
|
2 | use rocket::serde::json::Json;
| ^^^^ could not find `json` in `serde`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `my-api` due to previous error
Run Code Online (Sandbox Code Playgroud)
Cargo.toml
[package]
name = "my-api"
version = "0.1.0"
edition = "2021"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = "0.5.0-rc.1"
serde = "1.0.130"
Run Code Online (Sandbox Code Playgroud)
main.rs
[package]
name = …Run Code Online (Sandbox Code Playgroud) 我通过从root用户编译和安装来安装node.js. 我想这可能是挂断的地方.从运行rails应用程序的用户我检查了node.js.
$ which node
/usr/local/bin/node
Run Code Online (Sandbox Code Playgroud)
当我启动我的rails应用程序(Rails 3.2.9)时,我得到普遍无益的"我们很抱歉,但出了点问题." 检查生产错误日志我发现找不到Javascript运行时.这显然是安装的,这令人困惑.所以我开始强制使用Node javascript运行时.我编辑了config/boot.rb以包含:
ENV['EXECJS_RUNTIME'] = 'Node'
Run Code Online (Sandbox Code Playgroud)
我在查看生产日志时再次检查了我的应用程序.这次我收到了错误
ActionView::Template::Error (Node.js (V8) runtime is not available on this system
Run Code Online (Sandbox Code Playgroud)
仍然困惑.我去了execjs gem并将runtime命令更改为确切的安装路径.
Node = ExternalRuntime.new(
:name => "Node.js (V8)",
:command => "/usr/local/bin/node",
:runner_path => ExecJS.root + "/support/node_runner.js",
:encoding => 'UTF-8'
)
Run Code Online (Sandbox Code Playgroud)
我仍然得到同样的错误.节点已安装并可由用户访问,但gem/rails似乎无法使用它.服务器运行CentOS 6.3.导致错误被抛出的特定javascript文件是jquery.nivo.slider.pack.js.从nivo下载后我没有编辑.