NodeJS NEXE bundle error - node.js

I was trying to use NEXE to bundle my express 4 project. The bundling was sucessful, and a http_server.nex was generated. However, when I was trying to run the bundled file, I got the following error:
Error: ENOENT, no such file or directory '..../release/types/mime.types'
And I checked the release folder, the types folder and the mime.types file was never created. Any suggestions?
Or in general, what's the best way to deploy node project in a package? I tried several tools but none seem work so far. We need some level of obfuscation / compilation to have some code security.
Thank you in advance!

Related

DiscordJS & Heroku: Error: Cannot find module '../Modal'

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

react native runtime error while using react native cli

the error is "unable to load script. Make sure you are either running metro(run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release"
I researched a lot but the only answer I could find was making an assets folder than making changes to the blacklist.js file and running a script. but my project does not contain any blacklist.js file.

How to bundle project config files with parcel

I have created a common utility package which will be used by multiple node applications and for bundling it, I am using parcel which works fine but except one issue.
The common utility package consists of config files, which takes care of loading configuration as per env.
Issue:
While using this common utility package in a nodeapp I get the below error, when i try to run the app:
Error: loggerConfig config variable not found
at Object.n [as getLoggerConfig] (/Users/pm/Documents/example-service/node_modules/common.utils/dist/index.js:14:1037)
So It seems to me, the config files are not bundled along the build files generated.
Help Needed:
Is there a way we can tell parcel to bundle these config files as well?
Please guide me if I am thinking the wrong way.
Thanks in advance.

Vue-repo "Module build failed: Error: No ESLint configuration found"

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

Using locally develop npm module

I have developed a nodejs project as an umd library, with the purpose to use it in a another nodejs project. The library project builds fine and generates the index.js file and index.min.js file.
But when I tried installing the library project locally using npm install "asolute path". It brings all the things in the library project. And the size of my project I want to use the library project grew. Seems it is because of all the files in library project is getting copied.
Thanks for any help in advance.
Have you added an .npmignore file?
Also, you'll probably want to use npm link for local development.

Resources