简体   繁体   English

(在Rails上反应)引擎“节点”与此模块不兼容。 预期版本“…”

[英](React on Rails) The engine “node” is incompatible with this module. Expected version “…”

For those familiar with the react-on-rails gem, or more generally, yarn: 对于熟悉rail-on-rails宝石(或更普遍地说是纱线)的人们:

Just today I updated my Node version to 8.8.1 via Homebrew. 就在今天,我通过Homebrew将Node版本更新为8.8.1。 Now, when I attempt to run bundle && yarn && foreman start -f Procfile.dev (or just yarn install), I get the following message: 现在,当我尝试运行bundle && yarn && foreman start -f Procfile.dev (或仅是yarn install)时,我得到以下消息:

error react-webpack-rails-tutorial@0.0.1: The engine "node" is incompatible with this module. 错误react-webpack-rails-tutorial@0.0.1:引擎“节点”与此模块不兼容。 Expected version "5.10.0". 预期版本为“ 5.10.0”。

error Found incompatible module 错误发现不兼容的模块

info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. 信息请访问https://yarnpkg.com/en/docs/cli/install以获得有关此命令的文档。

This is likely a very simple issue I am running into, but I have been unable to fix it after a few hours of debugging. 这可能是我遇到的一个非常简单的问题,但是经过几个小时的调试后,我无法修复它。

I tried manually updating my Node version in package.json to be that on my computer (did not seem to take effect whatsoever), downgrading my version to 5.10.0 via Homebrew (but was unable to), and even upgrading to the latest version of the gem which meant installing webpack as well. 我尝试手动将package.json中的Node版本更新为我的计算机上的Node版本(似乎没有生效),通过Homebrew将我的版本降级到5.10.0(但无法),甚至升级到最新版本这意味着也要安装webpack。

No matter what I did, my local server startup ( bundle && yarn && foreman start -f Procfile.dev ) still lead to the same error above. 无论我做什么,我的本地服务器启动( bundle && yarn && foreman start -f Procfile.dev )仍然会导致上述相同错误。 Any ideas for this poor soul? 对这个可怜的灵魂有什么想法吗?

For anyone running into this same issue, I have not found a solution for the underlying issue but I have found a temporary workaround. 对于遇到同一问题的任何人,我都没有找到根本问题的解决方案,但找到了一个临时解决方法。

Simply run 只需运行

bundle && yarn --ignore-engines && foreman start -f Procfile.dev

instead of 代替

bundle && yarn && foreman start -f Procfile.dev

I hope this helps someone else that may have found themselves stuck in the same situation! 希望这对其他可能陷入同样困境的人有所帮助!

You need to update your Node.js version. 您需要更新您的Node.js版本。 Try to 尝试

  1. Clear NPM's cache: 清除NPM的缓存:

sudo npm cache clean -f

  1. Install a little helper called 'n' 安装一个名为“ n”的小助手

sudo npm install -gn

  1. Install latest stable Node.js version 安装最新的稳定Node.js版本

sudo n stable

I give you this list of checks to do from the react-webpack-rails-tutorial github page 我从react-webpack-rails-tutorial github页面上为您提供了检查清单

Basic Demo Setup 基本演示设置

  1. Be sure that you have Node installed! 确保已安装Node! We suggest nvm, with node version v6.0 or above. 我们建议使用节点版本为v6.0或更高版本的nvm。 See this article Updating and using nvm. 请参阅本文更新和使用nvm。

  2. git clone git@github.com:shakacode/react-webpack-rails-tutorial.git cd react-webpack-rails-tutorial git clone git@github.com:shakacode / react-webpack-rails-tutorial.git cd react-webpack-rails-tutorial

  3. Check that you have Ruby 2.3.0 or greater 检查您是否拥有Ruby 2.3.0或更高版本
  4. Check that you're using the right version of node. 检查您使用的节点版本是否正确。 Run nvm list to check. 运行nvm list进行检查。 Use 5.5 or greater. 使用5.5或更高。
  5. Check that you have Postgres installed. 检查您是否安装了Postgres。 Run which postgres to check. 运行要检查的postgres。 Use 9.4 or greater. 使用9.4或更高版本。
  6. Check that you have qmake installed. 检查是否已安装qmake。 Run which qmake to check. 运行要检查的qmake。 If missing, follow these instructions: Installing Qt and compiling capybara-webkit 如果缺少,请按照以下说明进行操作:安装Qt并编译capybara-webkit
  7. Check that you have Redis installed. 检查您是否已安装Redis。 Run which redis-server to check. 运行要检查的redis服务器。 If missing, install with Homebrew (brew install redis) or follow these instructions. 如果缺少,请使用Homebrew进行安装(brew install redis)或按照以下说明进行操作。
  8. bundle install 捆绑安装
  9. brew install yarn 冲泡安装纱
  10. yarn
  11. rake db:setup 耙db:setup
  12. foreman start -f Procfile.hot 工头开始-f Procfile.hot
  13. Open a browser tab to http://localhost:3000 for the Rails app example with HOT RELOADING 使用HOT RELOADING打开浏览器选项卡到http:// localhost:3000以获取Rails应用示例
  14. Try Hot Reloading steps below! 请尝试以下热加载步骤!
  15. foreman start -f Procfile.static 工头开始-f Procfile.static
  16. Open a browser tab to http://localhost:3000 for the Rails app example. 打开浏览器选项卡,以获取Rails应用程序示例的http:// localhost:3000
  17. When you make changes, you have to refresh the browser page. 进行更改时,必须刷新浏览器页面。

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

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