Almost finishing app and it started crashing - node.js

My app was working perfectly until I installed the accounts-facebook and service-configuration package. Now it's giving this error and I have absolutely no idea how to fix it:
/Users/###/.meteor/packages/meteor-tool/.1.1.3.1eul34x++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
throw(ex);
^
Error: Can't find npm module 'mongodb'. Did you forget to call 'Npm.depends' in package.js within the 'cfs_gridfs' package?
at Object.Npm.require (/Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:155:17)
at Package (packages/cfs:gridfs/gridfs.server.js:2:1)
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/packages/cfs_gridfs.js:189:4
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/packages/cfs_gridfs.js:196:3
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:222:10
at Array.forEach (native)
at Function._.each._.forEach (/Users/###/.meteor/packages/meteor-tool/.1.1.3.1eul34x++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:117:5
Exited with code: 8
Your application is crashing. Waiting for file change.

What worked for me was simply hitting "Control + C" to stop my app and then running "meteor run" again.

Do you have the cfs_gridfs package?
Your console reference that package in the error

If you're using mrt it means that you're using an old version of Meteor. Once in a while I had similar issues and I would simply edit the file .meteor/packages and the problem was solved when I run meteor command. I'm not sure if the same applies here.

Related

Node.js node:internal/modules/cjs/loader:936 error while trying to use discord.js

I'm trying to make a discord bot with the command prefix "*" but when I try to get the bot online/run it, it gives me this error:
node:internal/modules/cjs/loader:936
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:\Users\name\const'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
The module I'm using is discord.js and i've installed discord.js on CMD and the VSC terminal but it still comes up with the MODULE NOT FOUND error. I've looked around the internet and I can't find one that fixes the problem. I've tried reinstalling Node.js but it won't stop coming back. Please help, Thanks!
same error with me but I just change file dir cause I run node <filename.js> in the wrong dir so I just change like ---
the first step chacks you are in the right dir or not type: > ls
then if you are in the right dir then type: node <filename.js> if not then change your dir to change dir type: cd <filename>
and then run your first app or file for run type: node <filename.js>
I hope your error is solved!
you need to run it as an administrator so sudo(whatever you tryna run) as long as you are in the right directory
On Windows I solved it like this.
I went to the folder: C:\Users\Documents\AppData\Roaming\npm
And I deleted the file. create-react-app.
I started the project again, and it worked.
root cause, my path was messed up, but I only figured that out once I found where my npm packages where. I had thought they were in ../Programs/Roaming/npm etc but since an update (I think to node) my packages were actually in a Python Lib subdir.
Your Answer might be the same as mine, and I found out all this by using the
npm list -g
Command - which showed the globally installed packages, but also highlighted that this was nowhere to be found in my path
Hope this helps someone!
I had the same error and it was a case of trying to run the file in node from the wrong location.
My solution was to use the terminal and CD into the exact folder the file I was trying to run were and then after that I could run node filename.js.
In my case (this error ocurred at running docker container of next app), it was because I was running docker-compose without the flag --build, but of without copy lock files (package-lock.json and/or yarn.lock).
I updated my Dockerfile:
[...]
COPY yarn.lock .
RUN yarn install --frozen-lockfile
CMD [ "yarn", "dev" ]
And after, run with docker-compose up --build
When I was following a JS tutorial i got this error message too.
The problem was I copied an existing JS file and renamed it but it
through that error when i ran it.
When i created a new JS file, and copied the code in, and ran, it worked.
Before starting your server you need to make sure that the start file is mentioned below
cross-env NODE_ENV=production node index<start file name eg:index for index.js>
It happens when you run npm run start without getting into the project first... So, before starting to compile your project, run this command: cd <project folder name>...
It will stop showing the "Missing Module" Error and smoothly run your desired output in your browser
When was trying to find 'npm' & 'Rdme' path from command prompt to update the Rdme was getting this error Log
This error is caused when file can't be found or its a wrong path, In my case I added the missing file to respective folders- configured & updated in Environment variables (after adding missing files)
For the coming next. For me I'v got the error when I tried to run a package.json script with the npx run rather npm run.
In my case, I used chocolatey to install nodejs and it fixed my issue.
Open an Administrator Command Prompt (right click Command Prompt and select "Run as Administrator"), then run the following command:
choco install -y nodejs-lts
I hope it works for you too :)
The error tells that you've required packages that you haven't installed. So please make sure that you've installed every package that you've required in your bot. Also if you're sure that you've installed it, please check it again, there were namely some problems for some people that some of their packages got uninstalled while updating Discord.js to version 13.
For your problem in the comments ("TypeError [CLIENT_MISSING_INTENTS]"), it is now required in Discord.js version 13 to add your needed intents in the client. Please read this part of the Discord.js guide.
I fixed this issue by changing the opened directory of the terminal. Just go to the terminal and type: cd <folder name> until you reach the folder in which your js file is located. Then save and run again.
npm uninstall webpack-cli -D
npm install webpack-cli#3.3.12 --save-dev
than work fine

My nodemon app crashed after updating npm. What to do?

I went ahead and used npm update in my terminal(hyper) and when I tried to restart my app.js server, I got an error stating
[nodemon] app crashed - waiting for file changes before starting...
I thought I needed to use this command (npm update) in order to update my node modules, but then for some reason, some modules got deleted. ("Error: Cannot find module 'parseurl'"). I'm still a newbie to development and have no clue where to go from here. What to do?
Here's a screenshot of the error in my terminal.
screenshot of error
Nodemon tried to start the server, but it won't start successfully if it can't find the module you are referencing. Try reinstalling "parseurl" npm i parseurl and make sure the path to the module is correct. Once you have done that, the server should start successfully pending any other issues.

Error when starting Nodemon on my server.js file (Nodejs)

I recently started getting an error in my terminal when I start nodemon on my server.js file within my directory. Here is a picture below
Here is the error.
dyld: lazy symbol binding failed: Symbol not found: _node_module_register
Referenced from: /Users/dan/nodeStuff/crm-test/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/Release/bson.node
Expected in: dynamic lookup
Not sure what the issue is. I did a brew update and also made sure my port was correct.
For anyone else who stumbles by this problem, I had the same issue when trying to start my server with nodemon.
For me, the problem was I was still using an older version of node with nvm. I switched back to the version appropriate for my application and problem solved!
Did you try running node server.js?
Maybe it's not nodemon.
I've looked around and I did a npm rebuild which helped. When I start nodemon server.js or node server.js it tells me that one of the packages I was using is depreciated, I'm guessing that's what threw the error. Not sure why body-parser is depreciated.

Error running sample code using Spooky.js

I am new to the whole stack of node.js, phantom.js, casper.js and spooky.js. I have everything installed (in Windows), with PATH updated and followed this example:
https://github.com/WaterfallEngineering/SpookyJS
I got this error:
C:\node_modules\spooky>node examples/hello.js
events.js:68
throw arguments[1]; // Unhandled 'error' event
^
Error: Child terminated with non-zero exit code 127
at Spooky._spawnChild.Spooky._instances.(anonymous function) (C:\node_module
s\spooky\lib\spooky.js:82:17)
at ChildProcess.EventEmitter.emit (events.js:96:17)
at Process._handle.onexit (child_process.js:678:10)
Anyone has any clue why and how to fix it? I run casperjs googlelinks.js just fine. But with node.js and spooky.js, it gave me trouble.
This is due to the CasperJS Windows executable being named casperjs.bat instead of casperjs. See this comment on the bug #mike mentioned.
Unfortunately, you'll have to hack around this bug for the moment. I will release a fix for that this week.
This is based on the workaround provided by #mike and #lawnsea, which did lead me to the solution, but were not immediately clear to a beginner like me. The tip from minaki also helped me understand what to do: https://github.com/WaterfallEngineering/SpookyJS/issues/14
INSTALL SPOOKY.JS ON WINDOWS 7 WITH NPM.
I'm using:
Win7 64 bit
Node v0.10.17
CasperJS 1.1.0-DEV
PhantomJS 1.9.2
Added everything to my $PATH already
Steps:
Fresh directory: mkdir spookytest, cd spookytest
npm install spooky
open spookytest\node_modules\spooky\lib\spooky.js in a text editor
Change Line 26 (defaults.child.command) from 'casperjs' to 'casperjs.bat'
Change Line 30 (defaults.child.transport) from 'stdio' to 'http'
Save and go back to the spookytestdirectory
node node_modules/spooky/examples/hello.js
--> Hello, from Spooky the Tuff Little Ghost - Wikipedia, the free encyclopedia

node.js:201 process.nextTick error?

So I'm messing around with meteor, and out of no where I received this error? What is it asking me to change?
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected end of input
at /Users/devinandrews/my_cool_app/.meteor/local/build/server/server.js:109:21
at Array.forEach (native)
at Function.<anonymous>(/Users/devinandrews/my_cool_app/.meteor/local/build/server/underscore.js:76:11)
at /Users/devinandrews/my_cool_app/.meteor/local/build/server/server.js:95:7
Exited with code: 1
Your application is crashing. Waiting for file change.
Thanks guys..
You need to look through the code and see what it's doing in server.js around 109. It is probably working with a network connection that is being abruptly terminated. Are you doing anything like accessing your site with curl and CTRL-C-ing it while it's connected to your server? Because of the disconnected nature of vanilla node.js stack traces, we need to see the code to help you debug this.
This error comes up when you have a syntax error. Perhaps you are missing a closing brace in server.js?
Check that you don't have duplicate and possibly conflicting versions of modules in your global and local paths.
npm list
and
npm list -g
should not list duplicate and/or conflicting versions of modules.
In my case I had ws installed locally and some of its dependencies were also on the global path.
My solution was to remove everything from my local path and just install everything globally.
I've came across this error when I tried to start my server running on ubuntu on a well-known port (0-1023)
If that's the case, just run it as superuser (sudo)
In case that's not possible for you, check out this alternative (https://serverfault.com/a/112798)
in my experience was getting that error, caused by NPM and Node are not match version.
Need make sure NPM and Node are match (not mean same version)

Resources