Closed GabrielCHP closed 2 years ago
Hi @jonasnapoles , I meant, do you have a
node_modules
folder outside of yourclient
andserver
folder?It's working perfectly fine when i try running
heroku local
,and I'm able to deploy on heroku too after having a
package.json
outside of myclient
andserver
file:However it's still Application Error on Heroku even after it builds successfully. Do you have any idea why?
My error: node:internal/modules/cjs/loader:936 2022-03-29T01:47:57.534626+00:00 app[web.1]: throw err; 2022-03-29T01:47:57.534626+00:00 app[web.1]: ^ 2022-03-29T01:47:57.534627+00:00 app[web.1]: 2022-03-29T01:47:57.534627+00:00 app[web.1]: Error: Cannot find module '/app/index.js' 2022-03-29T01:47:57.534628+00:00 app[web.1]: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) 2022-03-29T01:47:57.534630+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:778:27) 2022-03-29T01:47:57.534630+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) 2022-03-29T01:47:57.534631+00:00 app[web.1]: at node:internal/main/run_main_module:17:47 { 2022-03-29T01:47:57.534631+00:00 app[web.1]: code: 'MODULE_NOT_FOUND', 2022-03-29T01:47:57.534632+00:00 app[web.1]: requireStack: [] 2022-03-29T01:47:57.534632+00:00 app[web.1]: }
@celestinecyr
I have the node_modules
I never used Heroku
before, therefore I removed node_modules
folder completely then and I run npm install
again.
After that I run npm
start which was working.
I hope I helped
SOLVED
Fixed by deleting node_modules directory, yarn.lock, package-lock.json and then installing again.
Hey, I solved this by using npm install axios --save
in my terminal(I am using VSCode and I used the built-in terminal there), hope that solves your problems as well!
fixing project path like duplicates names in folders or keyboard symbols solv my same issue here
I have the same problem
In my exact same case the problem was that I wasn´t inside the EXACT directory of the file, but in a folder containing each project folder (/Projects)>(Projects/project1)> node myproject1.js I hope this helps :)
@jonasnapoles how is it solved? For me still an issue
Yo, Maybe it will help for some of you.
Here is what worked for me: So, my main folder was named incorrectly, i had some spaces and dots in the root folder name, so I removed them, and i restarted the VSCode.
After that, for some reason npm run build
did work for me.
and my package.json:
{
"name": "webpack-typescript",
"version": "1.0.0",
"description": "Webpack is a bundling tool, it helps with the workflow.\r It helps to take all of the code and source from your code, and create an optimazied version of it, that is ready for distrebution.",
"main": "index.js",
"scripts": {
"build": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"ts-loader": "^9.3.0",
"typescript": "^4.6.4",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2"
}
}
Well it seems this method is not working even for you(Even I'm getting the same error).
We'll figure out something.
for me also not working kindly give suggestions
SOLVED
how did you solved, i did everything deleted node modules and installed again still i am facing the issue kindly suggest me please
try deleting the node modules folder and move the whole project folder to another place in your system and run
npm install
this method solved the problem for me
I will try this one thanks for your suggestion
On Thu, 12 May, 2022, 10:05 pm Hassan Abdellah, @.***> wrote:
try deleting the node modules folder and move the whole project folder to another place in your system and run npm install
this method solved the problem for me
— Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/3709#issuecomment-1125280788, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASI73XZVJJFJIIPZDWJ3BXDVJVB6DANCNFSM5M7JOBJA . You are receiving this because you commented.Message ID: @.***>
I thought I had the same problem... and only after drinking a cup of coffee I noticed my mistake: Instead of
npm install
I had typednode install
... and of course no such module could be found. From the initial error description this looks very similar.
Man I just figure out the problem! Using your comment, it really worked for me, the issue is acctually in every new folder you creat, you have to "install" the module! So I had this problem whe changed my folder, so after I typed npm install
all has been solved!
GUYS I FOUND THE SOLUTION! Please let the name of your PNG images short, with no SPACE OR CAPITALIZED LETTERS! Try using short names for accessories, body, or whatever you are doing on NFTs! Don't put any special character!
GUYS I FOUND THE SOLUTION! Please let the name of your PNG images short, with no SPACE OR CAPITALIZED LETTERS! Try using short names for accessories, body, or whatever you are doing on NFTs! Don't put any special character!
I don't think this is a solution though. A proper solution must specify what's the max length limit for all assets, and perhaps solve this error.
I'll comment my mistake with a fix hoping it will help someone. I was using nodemon incorrectly, i was calling it as "nodemon ." in my terminal, when I used "npx nodemon src/index.js" it worked. Hope that fixes a VS Code or two out there.
I found out that it is the problem of my node.js version. After a switch from 18.2.0
back to 10.24.1
the problem is solved.
Yeah I'm facing similar problem.
Any solution(s) for this?
just check the path is correct in app.js
const date = require(___dirname + "/views/date.js"_);
Yeah I'm facing similar problem. Any solution(s) for this?
just check the path is correct in app.js
const date = require(___dirname + "/views/date.js"_);
no meu caso o que resolveu foi ir para o diretório correto
Send me your error so know your problem more clearly
Check the dir. Name of respective ejsfile
this error occurs when the server is started in folder outside the project
I found what was problem for me. Actually my folder structure was going like this: Web Dev & Programming => Udemy ReacJS => -First React Big Project => senbonzakura-food
And this "&" in the "Web Dev & Progamming" was making the probelm.
Just add "engines": { "node": "16.x", "npm": "6.x" },
it will work and runs correctly for nodejs REST apis
In my case i had enter to src folder from the terminal. It was bad standing.
I fixed it in the suck ways. First off all i tried to delete modules and package-lock.json then npm i to reinstall it but not work. Second i make new forder then delete modules and package-lock.json and remove the remaining items to the new forder, after that npm i to reinstall it but still not work. Finnaly i kinda make 1 new file to test and the modules run on that but not run on the file i want so i do type ls on my cmd and copy the name of the file i want from cmd to run node filename.js again and IT WORK!!! i don't know that it really the point when copy the exact name from cdm but i hope this gonna help.
I found a solution (excuse my english) First, search WHERE is "yournamefile".js then in vs code console do: cd "the location of yournamefile.js" finally do: node "yournamefile".js Technically it's just the location of your file, if it isnt, this is the video that helped me: https://www.youtube.com/watch?v=2FJ7HjW8OjY
Saludos la solución para mi fue eliminar la carpera node_modules, instalar lite-server, agregar el cambio en el json, y agregar un commit. luego ya funciono todo ok
I was able to solve the issue for me. of course it won't help everyone since you may have other related issues causing this. the main issue I've had is that the node were looking for dependencies that I've removed from the project later on.
node_modules folder, and package-lock.json
on a 2nd computer with similar issue it didn't worked without running: npm cache clean --force And restart of the IDE before running npm install
npm install Now the node should start up without problems.
hope it helped some of you
npm audit fix --force
npm install axios --save
broooooo it worked....... thankssssssssss
Yeah I'm facing similar problem.
Any solution(s) for this?
Yeah same here
I had the same issue but with yarn, so i deleted node modules, yarn.lock and .yarnrc and then ran yarn to install it all again. Now it's working like a charm
The error is explained here "Error: Cannot find module ... " It means in your app.js or server.js do not list modules you didn't install or use. If the error is about a file path, it just means the path is incorrect.
O que resolveu pra mim: criei o script na package.json: "dev": "sucrase-node src/server.js" , e dei yarn dev, note que coloquei src/server.js, se eu colocasse somente server.js, ele nao encontraria o arquivo e dava o erro
I do not agree that this issue should be closed since there was not an accurate answer. I could find the answer to this issue. First you have to remember that you have npm and npx. In this case you have to use npx ts-node file_name.ts
. Always keep in mind that Npm is a tool that is used to install packages. On the other hand, Npx is a tool that is used to execute packages.
remove this line
The problem is that you are not in the correct folder to run the application or the script, you would have to open the terminal where it is located or search for it with VScode and try again
Yeah I'm facing similar problem. Any solution(s) for this?
just check the path is correct in app.js const date = require(___dirname + "/views/date.js"_);
no meu caso o que resolveu foi ir para o diretório correto
DO RESTART, it
Yeah I'm facing similar problem.
Any solution(s) for this?
restart ur PC, it will work fine
I am also getting the same error so what to do . even i did again install npm but also got error.
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'react-dev-utils/WatchMissingNodeModulesPlugin' Require stack:
node scripts/start.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Gurucharan sahay\AppData\Roaming\npm-cache_logs\2022-08-24T09_35_13_075Z-debug.log
C:\Users\Gurucharan sahay\Downloads\Gurucharan (2)\mernProjectEcommerce-master\mernProjectEcommerce-master\frontend>
Thats not gonna work at all, try to recreate your app instead, lmao!!
Olá! Verifica na sua pasta packjson se o caminho realmente está correto para iniciar, da um npm install -g nodemon. Deu certo aqui.
GUYS I FOUND THE SOLUTION! Please let the name of your PNG images short, with no SPACE OR CAPITALIZED LETTERS! Try using short names for accessories, body, or whatever you are doing on NFTs! Don't put any special character!
I don't think this is a solution though. A proper solution must specify what's the max length limit for all assets, and perhaps solve this error.
THAT'S JUST THAT, PAY ATTENTION TO THE PATH NAME TO THE PROJECT, IF POSSIBLE DO NOT USE SPECIAL CHARACTERS OR BLANKS
@devvsakib oh my god! how to be smart like this! I can't imagin! waw incredible
thanku thanku🤣
Deleting the project and re-installing worked for me. Just try if you didn't find any solutions 😅
Deleting the project and re-installing worked for me. Just try if you didn't find any solutions 😅
thats what i said, but no one care🤣this is the solution for this stupid prblem🤣
I deleted it again and again on linux and windows ... didn't not work besided I tried to manipulate the scripts in package.json also didn't work please check this link : https://github.com/wbkd/webpack-starter
this is the project for pluralsight course... educative
Version
No response
Platform
Windows Powershell
Subsystem
Powershell
What steps will reproduce the bug?
Downloading node.js > Opening the Windows Powershell > Selecting the Folder > node install. # Not working!
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:__MACOSX\hashlips\install' ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }
Additional information