nodejs,excjs: Could not find a JavaScript runtime. See https://github.com/sst

本文提供了两种解决ExecJS未找到运行时环境的方法。方法一通过在Gemfile中添加'execjs'和'therubyracer'并运行bundle install来解决。方法二是安装Node.js及其包管理器npm,并使用npm安装node。
方法1:
在gemfile中添加
gem 'execjs'
gem 'therubyracer'

bundle install后即可

方法2:
1. 安装nodejs
sudo apt-get install nodejs

node
gem install node
Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /login from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /captchaImage from localhost to http://localhost:9090/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).
10-15
`ECONNREFUSED` 错误通常表示客户端尝试连接到服务器时,服务器没有在指定的地址和端口上监听,可能是服务器未启动、端口被占用或者防火墙阻止了连接。以下是一些可能的解决方法: ### 检查服务器是否启动 确保 `http://localhost:9090` 对应的服务器已经启动并且正常运行。可以通过以下方式检查: - 尝试在浏览器中直接访问 `http://localhost:9090`,如果无法访问,说明服务器可能未启动。 - 查看服务器的日志文件,确认是否有启动错误。 ### 检查端口是否被占用 检查端口 `9090` 是否被其他应用程序占用。可以使用以下命令来检查端口占用情况: - 在 Windows 上,可以使用 `netstat -ano | findstr :9090` 命令。 - 在 Linux 或 macOS 上,可以使用 `lsof -i :9090` 命令。 如果端口被占用,可以尝试关闭占用该端口的应用程序,或者修改服务器配置,使用其他端口。 ### 检查防火墙设置 防火墙可能会阻止客户端与服务器之间的连接。确保防火墙允许客户端访问 `http://localhost:9090`: - 在 Windows 上,可以检查防火墙的入站规则,确保允许访问端口 `9090`。 - 在 Linux 上,可以使用 `iptables` 或 `firewalld` 来配置防火墙规则。 ### 检查代理配置 确保代理配置正确,特别是代理的目标地址和端口。如果使用的是 `vue-cli` 或 `webpack` 等工具进行代理配置,可以检查 `vue.config.js` 或 `webpack.config.js` 文件中的代理配置是否正确。例如,在 `vue.config.js` 中,代理配置可能如下: ```javascript module.exports = { devServer: { proxy: { '/captchaImage': { target: 'http://localhost:9090', changeOrigin: true, pathRewrite: { '^/captchaImage': '/captchaImage' } }, '/login': { target: 'http://localhost:9090', changeOrigin: true, pathRewrite: { '^/login': '/login' } } } } } ``` ### 检查服务器配置 确保服务器配置允许跨域请求。如果服务器是基于 Spring Boot 开发的,可以在服务器端添加跨域配置,例如: ```java import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; @Configuration public class CorsConfig { @Bean public CorsFilter corsFilter() { CorsConfiguration config = new CorsConfiguration(); config.addAllowedOriginPattern("*"); config.addAllowedHeader("*"); config.addAllowedMethod("*"); config.setAllowCredentials(true); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值