使用 react_on_rails gem 创建演示项目中的节点问题
node Issue in Creating demo project using react_on_rails gem
我正在尝试按照此 tutorial 使用 gem react_on_rails
创建一个虚拟项目
我想我已经按照教程的每一步进行了操作,但是在我们必须 运行 项目的最后一步弹出了一个与节点 js 相关的错误。
我什至在系统上更新了我的节点版本,仍然面临同样的问题
错误
foreman start -f Procfile.dev
22:30:58 web.1 | started with pid 5370
22:30:58 client.1 | started with pid 5371
22:30:59 client.1 | (in /home/projects/test-react-on-rails)
22:31:00 web.1 | => Booting Puma
22:31:00 web.1 | => Rails 5.1.2 application starting in development on http://localhost:3000
22:31:00 web.1 | => Run `rails server -h` for more startup options
22:31:00 web.1 | Puma starting in single mode...
22:31:00 web.1 | * Version 3.9.1 (ruby 2.4.0-p0), codename: Private Caller
22:31:00 web.1 | * Min threads: 5, max threads: 5
22:31:00 web.1 | * Environment: development
22:31:00 web.1 | * Listening on tcp://localhost:3000
22:31:00 web.1 | Use Ctrl-C to stop
22:31:01 client.1 | yarn run v0.27.5
22:31:01 client.1 | $ NODE_ENV=development webpack -w --config webpack.config.js
22:31:01 client.1 | /home/projects/test-react-on-rails/client/webpack.config.js:6
22:31:01 client.1 | const {resolve } = require('path');
22:31:01 client.1 | ^
22:31:01 client.1 |
22:31:01 client.1 | SyntaxError: Unexpected token {
22:31:01 client.1 | at exports.runInThisContext (vm.js:53:16)
22:31:01 client.1 | at Module._compile (module.js:373:25)
22:31:01 client.1 | at Object.Module._extensions..js (module.js:416:10)
22:31:01 client.1 | at Module.load (module.js:343:32)
22:31:01 client.1 | at Function.Module._load (module.js:300:12)
22:31:01 client.1 | at Module.require (module.js:353:17)
22:31:01 client.1 | at require (internal/module.js:12:17)
22:31:01 client.1 | at requireConfig (/home/shubhangi/projects/test-react-on-rails/client/node_modules/webpack/bin/convert-argv.js:96:18)
22:31:01 client.1 | at /home/projects/test-react-on-rails/client/node_modules/webpack/bin/convert-argv.js:109:17
22:31:01 client.1 | at Array.forEach (native)
22:31:01 client.1 | error Command failed with exit code 1.
22:31:01 client.1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22:31:02 client.1 | exited with code 1
22:31:02 system | sending SIGTERM to all processes
22:31:02 web.1 | - Gracefully stopping, waiting for requests to finish
22:31:02 web.1 | === puma shutdown: 2017-07-27 22:31:02 +0530 ===
22:31:02 web.1 | - Goodbye!
22:31:02 web.1 | Exiting
22:31:02 web.1 | exited with code 0
您正在尝试使用 object destructuring, which was first supported in Node version 6,但在 Node 4 中不可用。
您应该升级您的 Node 版本,特别是因为不再积极维护版本 4,这意味着仅应用 关键 修复程序,直到它达到生命周期结束(对于详情见 LTS schedule).
如果您仍然必须使用节点 4,则不能使用对象解构并且必须将行更改为:
const resolve = require('path').resolve;
另一种可能性是使用 Babel 转换不受支持的功能,但这对于配置来说似乎有点笨重。
我正在尝试按照此 tutorial 使用 gem react_on_rails
创建一个虚拟项目我想我已经按照教程的每一步进行了操作,但是在我们必须 运行 项目的最后一步弹出了一个与节点 js 相关的错误。 我什至在系统上更新了我的节点版本,仍然面临同样的问题
错误
foreman start -f Procfile.dev
22:30:58 web.1 | started with pid 5370
22:30:58 client.1 | started with pid 5371
22:30:59 client.1 | (in /home/projects/test-react-on-rails)
22:31:00 web.1 | => Booting Puma
22:31:00 web.1 | => Rails 5.1.2 application starting in development on http://localhost:3000
22:31:00 web.1 | => Run `rails server -h` for more startup options
22:31:00 web.1 | Puma starting in single mode...
22:31:00 web.1 | * Version 3.9.1 (ruby 2.4.0-p0), codename: Private Caller
22:31:00 web.1 | * Min threads: 5, max threads: 5
22:31:00 web.1 | * Environment: development
22:31:00 web.1 | * Listening on tcp://localhost:3000
22:31:00 web.1 | Use Ctrl-C to stop
22:31:01 client.1 | yarn run v0.27.5
22:31:01 client.1 | $ NODE_ENV=development webpack -w --config webpack.config.js
22:31:01 client.1 | /home/projects/test-react-on-rails/client/webpack.config.js:6
22:31:01 client.1 | const {resolve } = require('path');
22:31:01 client.1 | ^
22:31:01 client.1 |
22:31:01 client.1 | SyntaxError: Unexpected token {
22:31:01 client.1 | at exports.runInThisContext (vm.js:53:16)
22:31:01 client.1 | at Module._compile (module.js:373:25)
22:31:01 client.1 | at Object.Module._extensions..js (module.js:416:10)
22:31:01 client.1 | at Module.load (module.js:343:32)
22:31:01 client.1 | at Function.Module._load (module.js:300:12)
22:31:01 client.1 | at Module.require (module.js:353:17)
22:31:01 client.1 | at require (internal/module.js:12:17)
22:31:01 client.1 | at requireConfig (/home/shubhangi/projects/test-react-on-rails/client/node_modules/webpack/bin/convert-argv.js:96:18)
22:31:01 client.1 | at /home/projects/test-react-on-rails/client/node_modules/webpack/bin/convert-argv.js:109:17
22:31:01 client.1 | at Array.forEach (native)
22:31:01 client.1 | error Command failed with exit code 1.
22:31:01 client.1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22:31:02 client.1 | exited with code 1
22:31:02 system | sending SIGTERM to all processes
22:31:02 web.1 | - Gracefully stopping, waiting for requests to finish
22:31:02 web.1 | === puma shutdown: 2017-07-27 22:31:02 +0530 ===
22:31:02 web.1 | - Goodbye!
22:31:02 web.1 | Exiting
22:31:02 web.1 | exited with code 0
您正在尝试使用 object destructuring, which was first supported in Node version 6,但在 Node 4 中不可用。
您应该升级您的 Node 版本,特别是因为不再积极维护版本 4,这意味着仅应用 关键 修复程序,直到它达到生命周期结束(对于详情见 LTS schedule).
如果您仍然必须使用节点 4,则不能使用对象解构并且必须将行更改为:
const resolve = require('path').resolve;
另一种可能性是使用 Babel 转换不受支持的功能,但这对于配置来说似乎有点笨重。