Error: Cannot find module “mongodb” after meteor upgrade to 1.6.1.1 - meteor

edit - There is something strange: mongo appears in both package.json and in .meteor/packages files (should it appear in package.json at all?? it wasn't there before the update) but in different versions. here is my package.json:
{
"name": "something",
"version": "1.1.1",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"#babel/runtime": "^7.0.0-beta.49",
"babel-runtime": "^6.26.0",
"bootstrap": "^3.3.7",
"google-protobuf": "^3.5.0",
"grpc": "^1.12.2",
"grpc-tools": "^1.6.6",
"meteor-node-stubs": "^0.3.3",
**"mongodb": "^3.1.0-beta4",**
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react-progressbar.js": "^0.2.0",
"react-router": "^3.2.1",
"react-router-dom": "^4.2.2"
}
}
and here is my .meteor/packages:
meteor-base#1.3.0 # Packages every Meteor app needs to have
mobile-experience#1.0.5 # Packages for a great mobile UX
**mongo#1.4.2 # The database Meteor supports right now**
blaze-html-templates#1.0.4 # Compile .html files into Meteor Blaze views
reactive-var#1.0.11 # Reactive variable for tracker
tracker#1.1.3 # Meteor's client-side reactive programming library
standard-minifier-css#1.4.0 # CSS minifier run for production mode
standard-minifier-js#2.3.1 # JS minifier run for production mode
es5-shim#4.7.0 # ECMAScript 5 compatibility for older browsers
ecmascript#0.10.6 # Enable ECMAScript2015+ syntax in app code
shell-server#0.3.1 # Server-side component of the `meteor shell` command
session#1.1.7
tarang:ssl
After updating to 1.6.1.1, my app won’t run, crashing with message 'Error: Cannot find module “mongodb” '.
Tried to run meteor npm install, even took away the entire node_modules folder and built it again.
Tried to run meteor npm update.
Tried to run meteor npm install mongodb.
Tried to downgrade back to version 1.6.0.1.
Still can’t find mongodb.
Important - mongodb is there, all collections are there - I can access it through the terminal with "meteor mongo".
Any help?
If it helps - The data in the db can be erased if there is no other way.
(running on ubuntu 16.04)
Thanks

In the end, the problem was not in the project but in meteor globally, so I uninstalled and re-installed meteor globally, and everything got back to normal…
Thank you all!

Related

#parcel/core: Failed to resolve 'process' from './node_modules/#firebase/firestore/dist/index.esm2017.js'

I'm working on a project and when I try to run parcel dev or build command it outputs the following error:
× Build failed.
#parcel/core: Failed to resolve 'process' from './node_modules/#firebase/firestore/dist/index.esm2017.js'
D:\Workspace\Front-End\Apps\RISC-Aswan\node_modules\#firebase\firestore\dist\index.esm2017.js:5741:38
5740 | return t.store(e);
> 5741 | }
> | ^
5742 | // visible for testing
5743 | /** Parse User Agent to determine iOS version. Returns -1 if not found. */
It was working before and now I don't know the cause of the problem. I tried to delete node__modules folder and run npm install but nothing changes.
I have the following imports in the script file:
import { initializeApp } from 'firebase/app';
import { getFirestore, collection, addDoc } from 'firebase/firestore';
the second line importing the firestore is what causing the problem, commenting it leads to everthing works fine.
Here's a photo with the terminal message and the esm2017.js file
My package.json dependecies:
"devDependencies": {
"autoprefixer": "^10.4.2",
"parcel": "^2.2.1",
"postcss": "^8.4.6",
"tailwindcss": "^3.0.18"
},
"dependencies": {
"firebase": "^9.6.6",
"vanilla-hamburger": "^0.2.3"
}
for some reason modifying alias to the following worked in dev and build
"alias": {
"process": {
"global": "{}"
}
}
Here's the other suggested workaround i tried mentioned in this issue
used alias in my package.json file
"alias": {
"process": "false"
}
manually installed process package
"dependencies": {
"process": "^0.11.10",
},
updated node to v16.14.0 instead of v16.13.1.
used parcel build ./src/index.html and removed "source": "./src/index.html" in the package.json
In your package.json you are defining parcel to be the higher version compatible with 2.2.1:
"devDependencies": {
"autoprefixer": "^10.4.2",
"parcel": "^2.2.1"
// Rest of packages
Currently there is an issue in the GitHub repository for parcel regarding this problem with Firebase. While that issue shows your exact error message, the general issue to keep track of is this open issue, since this problem affects libraries other than Firebase. Something you could do is to avoid using an affected version of parcel (2.3.1 as far as I see on the issues), or keep track of the issue to update to a fixed version when it releases.
EDIT (2/23/2021):
It seems that both GitHub issues are now closed with the release of Parcel 2.3.2. I tested building a React project with Parcel and Firebase using version 2.3.1, and I encountered the exact same error as you. Updating to 2.3.2 solved the issue completely on my end without any other change of dependencies. Just in case anyone comes across this thread later on.
I was using yarn on netlify and had to do this to fix:
echo 'nodeLinker: node-modules' >> /opt/build/repo/.yarnrc.yml

When updating Next.js v10.1.13 to webpack5, getting warnings Can't resolve 'fsevents' in chokidar

npm install next react react-dom And running Node.js v12
Created most simple pages/index.tsx
export default function PageHome(props) {
return <>Hello World!</>
}
(I also had TypeScript configured as per Next.js instructions but not sure if that's making a difference.)
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
...
event - compiled successfully
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
Self-answered solution below for future readers.
Upgrade Node.js
Delete package-lock.json and node_modules
Run npm install again
It works
Apparently something doesn't install when you run with an older Node.js version.
My package.json looked like
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^10.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"#types/react": "^17.0.3",
"typescript": "^4.2.4"
}
}
The same package.json will install slightly differently switching from Node.js v12 to Node.js v15 as I just observed. This is why you have to complete not just step 1, but also steps 2 & 3.
Before:
C:\GitHub\reproduce-nextjs-webpack5-error>node --version
v12.4.0
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
> # dev C:\GitHub\reproduce-nextjs-webpack5-error
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
event - compiled successfully
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
After:
C:\GitHub\reproduce-nextjs-webpack5-error>node --version
v15.14.0
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
> dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
Yay! No warnings!
While there are comments below about future changes in nextjs#canary, the above examples worked for me with versions listed.
Delete the .next folder and re-run npm run dev.
This happens when your system shuts down unexpectedly without saving.
I have resolved this problem by killing all node processes on my production server.

Meteor site locks up when trying to add new account

I recently updated my Meteor based website from 1.3 to 1.8, while including a Let's Encrypt SSL. When I attempt to add new users after being deployed using MUP, the UI for adding users collapses down to three strobing bars but never completes. When I attempt to run the page in another browser it gives me a 502 Bad Gateway error. This 502 error goes away when I refresh the original page attempting to create the account.
I built around using the 'turn key' accounts as provided. It works great while testing locally on my home computer.
This is all the install packages including the default after removing insecure and :
meteor-base#1.4.0 # Packages every Meteor app needs to have
mobile-experience#1.0.5 # Packages for a great mobile UX
mongo#1.6.2 # The database Meteor supports right now
blaze-html-templates#1.0.4 # Compile .html files into Meteor Blaze views
reactive-var#1.0.11 # Reactive variable for tracker
tracker#1.2.0 # Meteor's client-side reactive programming library
standard-minifier-css#1.5.3 # CSS minifier run for production mode
standard-minifier-js#2.4.1 # JS minifier run for production mode
es5-shim#4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript#0.12.4 # Enable ECMAScript2015+ syntax in app code
shell-server#0.4.0 # Server-side component of the `meteor shell` command
alexwine:bootstrap-4
oauth
iron:router
accounts-ui
accounts-password
accounts-facebook
accounts-google
session
underscore
facebook-config-ui
google-config-ui
And this is running stock accounts, there is no special code. I have set up the sign in for username and email in the client facing side of the JavaScript file:
Accounts.ui.config({
passwordSignupFields: "USERNAME_AND_EMAIL"
});
What is really frustrating is that my site works fine when ran on my local machine for testing, adding and updating users as necessary, but gets bogged down when deployed for some reason.
I'm so lost I don't even know know what would be causing it to hang like this so badly. Any help is greatly appreciated!
Edit: Adding package.json
{
"name": "DMachineWordBank",
"private": true,
"scripts": {
"start": "meteor run",
"test": "meteor test --once --driver-package meteortesting:mocha",
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"#babel/runtime": "^7.3.4",
"bcrypt": "^3.0.6",
"meteor-node-stubs": "^0.4.1",
"popper.js": "^1.15.0"
},
"meteor": {
"mainModule": {
"client": "client/main.js",
"server": "server/main.js"
},
"testModule": "tests/main.js"
}
}
if you remove bcrpt and ignore the following message does it fix production?
Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
(STDERR) approximately three times slower than the native implementation.
In order to use the native implementation instead, run
meteor npm install --save bcrypt
in the root directory of your application.

Trouble updating packages using Bower in ASP .NET vNext

I have started ASP .NET vNext and I was going through several articles about using bower in Visual Studio 2015 for managing client side libraries, it's pretty simple to use but I am having problems in updating the packages...
I am following this
bower.json:
"dependencies": {
"bootstrap": "3.3.2",
"jquery": "1.4.1",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0",
"jquery-migrate-official": "^1.2.1",
"bootstrap-hover-dropdown": "2.1.3",
"jquery-slimscroll": "1.3.3",
"jquery-cookie": "1.4.1",
"jquery.uniform": "4.3.0",
"blockui": "2.1.2",
"font-awesome": "4.3.0"
},
The intellisense says that the package blockui has the latest stable version 2.1.2 but package manager log says:
bower blockui#2.1.2 ENORESTARGET No tag found that was able to satisfy 2.1.2
bower blockui#2.1.2 not-cached git://github.com/malsup/blockui.git#2.1.2
bower blockui#2.1.2 resolve git://github.com/malsup/blockui.git#2.1.
Questions:
What does this mean? Is the intellisense picking up the wrong latest version?
Is there any better way to update all client side packages like I used to do using nuget package manager ?
update-package
I read that for server-side packages ASP .NET vNext will use nuget packages but when I write any command in my Package Manager Console nothing happens
update-package
install-package entityframework
You can right-click the 'Bower' node under the 'Dependencies' node and choose 'Restore Packages'. I often have to open the 'Task Runner Explorer' from 'View -> Other Windows' and run the 'bower' task from its context menu. This will trigger a bower installation.
gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: "wwwroot/lib",
layout: "byComponent",
cleanTargetDir: false
}
}
}
});
// This command registers the default task which will install bower packages into wwwroot/lib
grunt.registerTask("default", ["bower:install"]);
// The following line loads the grunt plugins.
// This line needs to be at the end of this this file.
grunt.loadNpmTasks("grunt-bower-task");
};
package.json
{
"version": "0.0.0",
"name": "",
"devDependencies": {
"grunt": "0.4.5",
"grunt-bower-task": "0.4.0"
}
}
The packages should then show up in your wwwroot -> lib directory.
Check out bower's website for more details: http://bower.io/
I just found that for (and for font-awesome package) IntelliSense advices non-existing version. That was 2.1.2, exactly like for your case, that is why I found your question.
I had re-checked real version, corrected it to existing one, and everything started to work.

Installing grunt on Openshift (without Node cartridge)

I would like to install grunt and grunt-cli to my OpenShift deployment (which is a Python 2.7 cartridge).
I have created a package.json file as follows:
{
"author": "--",
"name": "--",
"version": "0.3.0",
"homepage": "--",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli" : "~0.1.13",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-html2js": "^0.2.9",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-index-html-template": "^0.2.5",
"grunt-contrib-watch": "^0.6.1"
}
}
However, after SSHing into the server post deployment, grunt is not installed. My questions are:
requirements.json is more of a Node thing. Therefore, is it that OpenShift ignores this file because I am not using Node (even though NPM is installed).
If 1 is correct, how do I go about installing grunt? (I've tried running 'npm install -g grunt' both via SSH and in an action hook script, but the fails due to lack or permissions).
This guy had the same issue (Can I run Grunt/Gulp on my PHP 5.4 cartridge?) but I couldn't find what I needed in the answer.
Any suggestions?
you'll need to run scl enable nodejs010 in your ./action-hook/start command to enable a specific software collection in your gear. Hopefully that helps!

Resources