尝试localhost:3000时,它会抛出错误
ActionView::Template::Error (Autoprefixer doesn’t support Node v0.10.37. Update it.):
我尝试更新节点,但没有可用的更新。
node -v # v8.1.3
nodejs -v # v0.10.37
宝石文件
gem 'bootstrap', '~> 4.1.3', and others
Gemfile.lock
autoprefixer-rails (9.1.1)
答案 0 :(得分:9)
我遇到了类似的问题,并通过在您的gemfile中添加gem 'mini_racer'
来解决。
希望这会有所帮助!
答案 1 :(得分:1)
如果您只是搭建了一个新的Rails项目,请在Gemfile
上使用以下行进行检查
# gem 'mini_racer', platforms: :ruby
并取消注释。然后,您应该拥有
gem 'mini_racer', platforms: :ruby
运行bundle update
这对我有用。就像卡尔提到的那样。
答案 2 :(得分:1)
我遇到了这个问题,问题是我前一段时间随机安装了剩余的 nodejs 可执行文件。
见这里:https://github.com/twbs/bootstrap-rubygem/issues/162#issuecomment-440220624
我通过在终端 git rm -rf /usr/bin/nodejs
答案 3 :(得分:0)
对我来说,问题是 autoprefixer 作为另一个软件包的依赖项安装,但未指定版本,因此安装的版本为9.4.3,与我的本地Node冲突。安装。
我通过在GemFile中为该软件包添加特定版本并运行捆绑安装
来修复该问题gem 'autoprefixer-rails', '~> 7.1.6'
答案 4 :(得分:0)
对我来说,运行SemaphoreCI时发现了错误。
问题在于ExecJS(依赖项)具有一种设置Node的方法,该Node会导致问题。问题在于Node的初始化如下:
module ExecJS
module Runtimes
Node = ExternalRuntime.new(
name: "Node.js (V8)",
command: ["nodejs", "node"], # This line has the problem
runner_path: ExecJS.root + "/support/node_runner.js",
encoding: 'UTF-8'
)
end
end
因此,我通过在application.rb
文件的底部设置了此节点来更改了初始化节点的方式。
module ExecJS
module Runtimes
Node = ExternalRuntime.new(
name: "Node.js (V8)",
command: ["node", "nodejs"], # This is how to initialize Node
runner_path: ExecJS.root + "/support/node_runner.js",
encoding: 'UTF-8'
)
end
end