I am trying to add dashboard to my JHipster project, but I have a problem with node_modules. I added paths to js scripts in index.html, e.g.: , and when I tried open site I am receiving "Not found". Any ideas? Should I add js file to webpack?
Related
I am trying to migrate my application from create react app to Vite. I followed this tutorial article on how to do it. So far, I have deleted the node_modules folder, made the following changes:
changes to package.json:
then ran npm i, then made these changes to
I actually had to replace "start" with "dev" for this one to get it to work:
I then moved public/index.html to index.html (project root folder).
changes to index.html:
changes to index.html:
I added this vite.config.jsx file:
Lastly I replaced all .js file extensions with .jsx. But now when I enter npm run dev it is telling me it can't find multiple different modules. I get a message like this:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/Users/gtrman97/Documents/code/coding-projects/project/node_modules/esbuild/' imported from /Users/gtrman97/Documents/code/coding-projects/project/node_modules/vite/dist/node/cli.js
Out of curiosity, I commented out the import 'esbuild'; line in the cli.js file but got the same error with a different module:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/Users/gtrman97/Documents/code/coding-projects/project/node_modules/resolve/' imported from /Users/gtrman97/Documents/code/coding-projects/project/node_modules/vite/dist/node/cli.js
The easiest way to migrate from CRA to vite, for me, is to create a vite app and copy all the components I created and install all of the dependencies I have on the CRA app. And boom, it just works. At least for my typescript CRA project. (And by examing git diffs, not surprisingly, only the package.json file changed.)
So this is lately one of the most popular issues in discord.js community. Appears after updating to d.js v13.7.0 and higher. While it works perfectly on a PC or etc., it fails to run on Heroku hosting with the following message:
Error: Cannot find module '../Modal'
This is clear that the issue is on Heroku's side, because Modal file can be found in discord.js dependency folder in node_modules.
I have NodeJS v18.3.0, have tried reinstalling discord.js with multiple methods, nothing helped.
I wasn't able to find any solutions to the problem, have anyone over here found the solution?
Im pretty sure that you didn't create a file called .gitignore because it shows that your problem is on the folders '../Modal', Before deploying it to heroku, you should ignore the 2 files on your project.
node_modules
.env (if you have)
To remove these 2 on your deploying, create a file on your main folder named .gitignore and right down the following:
node_modules
.env
My Vue project is running fine locally, but when upload it to github repo, download it back from there and npm install, then npm run dev, it throws error Module build failed: Error: No ESLint configuration found.
When I unzip my downloaded repo-files, there's no .eslintrc etc. files that are present when I'm uploading my project, and to my knowledge that is one reason causing this ESLint problem.
Here's the very basic vue init webpack HelloWorld.vue uploaded to my test-repo without any modifications to show how it fails to build after downloading.
Link to my test repo to reproduce the error: https://github.com/tuuchen/vue-movie-app
How can I fix this issue with eslint?
EDIT: I made a fresh project without eslint, and when downloading it from my git repo, It's throwing Failed to compile error, asset optimization[copy-webpack-plugin] WARNING - unable to locate '<path>\myvueapp\static'
EDIT 2: Also .postcssrc is missing when initiating npm install
EDIT 3: Problem solved. I was using webpack for creating my vue project, and it caused all kinds of issues when downloading the project back from git repo. npm install -g #vue/cli did a project that worked without issues.
Sorry for being such a noob.
This issue came up as I created a new project by copying from another project on my Mac. However, the hidden files were not copied!
Solution
The issue got resolved by having these hidden files as well in the new project:
.babelrc,
.editorconfig
.eslintignore
.eslintrc.js
.postcssrc.js
There are other solutions that many have proposed in this Vue Issue that you can refer to if this does not solve your problem.
In my case, I just delete the folder Node.Js and try reinstall node modules using yarn/npm.
if it still did not work, you can try to add file .eslintignore on the root folder and add there the path to the folder we want to omit.
For example, in this scenario, .build/test.js is the desired file to allowlist. Because all dot-folders and their children are ignored by default, .build must first be allowlisted so that eslint becomes aware of its children. Then, .build/test.js must be explicitly allowlisted, while the rest of the content is denylisted. This is done with the following .eslintignore file:
# Allowlist 'test.js' in the '.build' folder
# But do not allow anything else in the '.build' folder to be linted
!.build
.build/*
!.build/test.js
more documentation https://eslint.org/docs/user-guide/configuring/ignoring-code#the-eslintignore-file
I'm trying to include a javascript file which is not available as bower.
So I copied it to src/main/webapp/content and referenced in index.html
In the DEV profile all is fine -- it works.
Now, after generating WAR file with the PROD profile, the custom.js file is not included in the WAR (tried to unpack -- file is not there).
I have discovered the gulp is merging all css and js files, did I miss a config for this?
When the app is loaded, the browser complains with 404 in the index.html -- js file not found.
How can I fix this? What is the right way to include JS (or CSS) file into JHipster app?
Thank you.
JS are not expected to be in content folder.
For CSS, copy your file to src/main/webapp/content/css.
For JS, copy your file to src/main/webapp/app possibly in a dedicated sub folder.
You don't have to inject them in index.html, gulp will do it for you. I suppose you did not see it in dev profile because you were not running gulp serve as explained in the doc
I installed angular2 in node_module, but as node_module is not static directory I can not use links of angular and its dependencies on html page.
what could be the proper way of doing this ?
Copy it somewhere in public folder, for example: js/vendor/...
This is usual way, otherwise you can break your application on npm update