简体   繁体   English

如何解决这个问题 - 无法解决 Rails 中的“app/javascript/*.*”问题

[英]How to solve this - Could not resolve "app/javascript/*.*" issue in Rails

I am currently working on a full-stack application where I need to use React for the Front-end and Rails for Back-end.我目前正在开发一个全栈应用程序,我需要将 React 用于前端,将 Rails 用于后端。 I am using Esbuild which gives me access to make use of jsx in rails.我正在使用jsx ,它让我可以在 rails 中使用 jsx。 However, I am having a series of issues with it as shown below.但是,我遇到了一系列问题,如下所示。 Please, how do I resolve this [ERROR] Could not resolve "app/javascript/*.*"请问,我该如何解决这个[ERROR] Could not resolve "app/javascript/*.*"

Could it be that it's not compatible with my system because I am seeing so many incompatibility issues in the log.可能是它与我的系统不兼容,因为我在日志中看到了很多不兼容问题。

Done in 65.24s.
Add build script
         run  npm set-script build "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets" from "."
npm WARN set-script set-script is deprecated, use `npm pkg set scripts.scriptname="cmd" instead.
         run  yarn build from "."
yarn run v1.22.15
warning ..\package.json: No license field
$ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets
X [ERROR] Could not resolve "app/javascript/*.*"

  It looks like you are trying to use glob syntax (i.e. "*") with esbuild. This syntax is
  typically handled by your shell, and isn't handled by esbuild itself. You must expand glob
  syntax first before passing your paths to esbuild.

1 error
node:child_process:879
    throw err;
    ^

Error: Command failed: C:\Users\Dennis\hello-rails-react\node_modules\esbuild-windows-64\esbuild.exe app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets

I had the same error while building my rails application.我在构建我的 rails 应用程序时遇到了同样的错误。

In the package.json file.在 package.json 文件中。 In the scripts section, Instead of a general path在脚本部分,而不是一般路径

app/javascript/*.* 

I specified the exact file name我指定了确切的文件名

app/javascript/application.js

and my problem was solved.我的问题就解决了。

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

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