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

I am currently working on a full-stack application where I need to use React for the Front-end and Rails for Back-end. I am using Esbuild which gives me access to make use of jsx in rails. 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/*.*"
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.
In the package.json file. 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.

Related

How do I solve the problem of modules not found in angular application?

I have an angular application that uses two libraries locally, however, when trying to build everything ending up with an error of modules not found, but I thought it was some problems of undeclared dependencies, or imported, but everything is fine.
For better understanding, I have: Two local libraries that are used by a test application, where this application consumes both libs, but in the compilation it presents the error of modules not found:
`Error: Module not found: Error: Can't resolve '#ngx-formly/example-kendo' in 'C:\SamuelPierre\Example\Repositório\NgBibliotecas\NgBibliotecas\projects\framework-example\src\app\shared'
Error: projects/framework-example/src/app/app.component.ts:1:34 - error TS2307: Cannot find module '#example-library/identity' or its corresponding type declarations.
1 import { UserTokenService } from '#example-library/identity';
~~~~~~~~~~~~~~~~~~~~~~~`
This error appears for all dependencies, but my main file has all the necessary imports and declarations.
Also, "npm install" to install the libraries doesn't help as they are accessed locally. I've already cleaned the node modules, reinstalled npm, everything is ok, but the problem persists.
maybe you should run npm install or when it just one module just do npm install <module name> -save
Try (in Terminal):
npm install

Getting an error when trying to run my test in webdriverio

I have been having an issue when trying to run my webdriverio tests after trying to upgrade my node version. I am now getting the following error
2022-01-11T12:45:05.628Z DEBUG #wdio/config:utils: Couldn't find ts-node package, no TypeScript compiling
2022-01-11T12:45:05.729Z ERROR #wdio/config:ConfigParser: Failed loading configuration file: /Users/eoincorr/Downloads/coding/DSI_UI_TESTS/wdioTest.conf.js: Cannot find module 'csv-stringify/sync'
Can someone please advise me on why this is happening and what to do?
It seems that you didn't install typescript and/or ts-node.
Install missed dependencies:
npm i -D typescript ts-node
Also make sure, that you have installed all dependencies such as csv-stringify

Javascript file cause React (Typescript) fail to start

I have a React project with Typescript. One day I create a javascript file in src/ and then my React app failed to start on localhost. Any explanation about this would be appriciated.
Evironment: Node 16.13.1
Step to reproduce:
git clone git#github.com:manaclan/fun-pms-frontend.git
cd fun-pms-frontend
git checkout vinhngo
Inside package.json remove:
"#types/react-facebook-login": "^4.1.4"
"react-facebook-login": "^4.1.1"
Then npm install and npm start will notify that localhost:3000 failed to connect. Removing src/setupProxy.js will make the server start as normal
That's because JavaScript is not allowed in Typescript projects, you would need to modify your Typescript config, add the following flag to to the config file
--allowJs
Depending on the module bundler you probably also have to set the output directory for the transpiled Typescript files.

Error when building next.js app: Can't resolve 'next/head'

I am getting the below error when doing next build in my next.js app, after it's been working fine with just next (or npm run dev).
The error:
$ next build
The module 'react-dom' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install --save react-dom'
Creating an optimized production build ...
> Using external babel configuration
> Location: "../.babelrc"
Failed to compile.
./pages/_app.js
Module not found: Can't resolve 'next/head' in '../pages'
> Build error occurred
Error: > Build failed because of webpack errors
at build (.../AppData/Roaming/npm/node_modules/next/dist/build/index.js:7:847)
I started my project by cloning Material UI's next.js example and just use that as it seems updated:
https://github.com/mui-org/material-ui/tree/master/examples/nextjs
However, thinking I just may of have an outdated or broken build, I re-cloned the next.js example and did next build as well, without modifying any files and I get the same error.
How can I fix this?
I just cloned that next.js example and it worked both with npm run dev, as well as npm run build->npm run start.
Judging by your error, I would check that "react-dom": "latest" is present in your package.json's dependencies. Did you run npm install after cloning the example?
The solution to this problem is to Just rerun these two commands again then your project will successfully Run. I also faced this problem but I got the solution.
npm i
yarn install
I ran into a similar problem when I included my nextjs app in a yarn workspace. I got around the issue by deleting the following directories in my nextjs app:
node_modules
.next
build
After removing them I ran yarn from the repo directory and started the nextjs app back up and it was working again.

warn Error on lookup for github:systemjs/systemjs

When I am setting my jspm installation with the command:
jspm init
Then it just asks me for the initial config:
Would you like jspm to prefix the jspm package.json properties under jspm? [yes]:yes
Enter server baseURL (public folder path) [./]:app
Enter jspm packages folder [app/jspm_packages]:
Enter config file path [app/config.js]:
Configuration file app/config.js doesn't exist, create it? [yes]:yes
Enter client baseURL (public folder URL) [/]:
Do you wish to use a transpiler? [yes]:no
Right after that, I am getting this error message:
warn Error on lookup for github:systemjs/systemjs
TypeError: "timeout" must be an unsigned integer
at validateTimeout (child_process.js:612:11)
at Object.exports.execFile (child_process.js:178:3)
at exports.exec (child_process.js:136:18)
at module.exports (/usr/local/lib/node_modules/jspm/node_modules/jspm-github/exec-git.js:64:5)
at /usr/local/lib/node_modules/jspm/node_modules/jspm-github/github.js:382:7
at initializePromise (/usr/local/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:588:5)
at new Promise (/usr/local/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:1076:31)
at GithubLocation.lookup (/usr/local/lib/node_modules/jspm/node_modules/jspm-github/github.js:381:12)
at /usr/local/lib/node_modules/jspm/lib/registry.js:117:30
at tryCatch (/usr/local/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/usr/local/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:553:13)
at /usr/local/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:628:16
at flush (/usr/local/lib/node_modules/jspm/node_modules/rsvp/dist/rsvp.js:2373:5)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
err
err Error downloading loader files.
err
Not sure what is happening right there. So I came here for some clues.
After trying too much to find was going on. I came with, it was happening that Jspm had no problems but my Node and Npm version were a pre-release (it seems like this affects the Jspm registry). I was using NodeJs 8.0.0. Anyway if someone stucks on the same, he/she should know that going back to
node v6.10.3 (npm v3.10.10) versions
fix this little inconvenient.
Works for me, the below commands:
brew update
brew install nvm
source $(brew --prefix nvm)/nvm.sh (adding to ~/.profile)
nvm install 6.10.3
For more information this is an excellent post about it

Categories

Resources