realm-cli push failed after adding new node module - node.js

I added a node module (otp-generator) to my MongoDB Realm app using the realm-cli, and it worked as expected. I'm now trying to add another node module (twilio) to my MongoDB Realm app, but for some reason it now is giving the following error message when I try to push my new node modules archive that includes both otp-generator and twilio:
push failed: failed to install dependencies: failed to transpile node_modules/otp-generator/._index.js. "otp-generator" is likely not supported yet. unknown: Unexpected character '' (1:0)
This message is very strange because the otp-generator was working perfectly fine before I installed Twilio. What's going on here?

I was able to figure out a solution myself. I just uninstalled the packages, and then reinstalled twilio before otp-generator. Here are the specific steps I did:
npm uninstall twilio
npm uninstall otp-generator
npm install twilio
npm install otp-generator
tar -czf node_modules.tar.gz node_modules/
And then I pushed my changes again to Realm, and it worked!
I'm not sure if installing twilio before otp-generator is what specifically resolved the problem, but at the very least uninstalling and reinstalling installing all node modules from scratch fixed it.

Related

Error: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'

I am using the following book to build a MERN stack CRUD application. I'm having trouble installing and running graphql.
https://www.amazon.com/Pro-MERN-Stack-Development-Express-dp-1484243900/dp/1484243900/ref=mt_paperback?_encoding=UTF8&me=&qid= (published in 2019).
When I try to start the server contained in this repo https://github.com/vasansr/pro-mern-stack-2/tree/05.02-graphql-schema-file with the command npm start the app crashes and it returns an
Error: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'
I then followed some advice from a previous instance of this question on here to npm install karma-sinon-chai for the dependancies. But then I get the following error:
npm WARN apollo-graphql#0.4.4 requires a peer of graphql#^14.2.1 but none is installed. You must install peer dependencies yourself.
For me simply running npm install -g graphql fixed the problem (I had already installed Apollo globally with npm install -g apollo).
As per the error message apollo-graphql required a module from the graphql library validation/rules/PossibleTypeExtentions. The version of graphql I was using, as found by looking in my package.json, was "graphql":"^0.13.2".
I first tried to change this by changing my package.json to "^14.3.1". But after trying to install and run graphql I got the same error messages and when I looked in my package.json it had reverted back to "^0.13.2".
This may have been caused by my package.lock, locking me into that version. I then deleted package.lock, and node_modules folder.
I then ran the command nom install --save graphql#14.3.1, this worked fine.
I then just had to reinstall babel and Apollo-server-express and after this everything worked fine.

Argon2 is difficult to get working with Angular 8 on MacOS: actually not working at all

I am working with:
MacOS Mojave
Angular 8
node v12.12.0
npm v6.13.4
and trying to make Argon2 to work in my Angular 8 app.
In order to use Argon2 it is required to install gcc and node-gyp globally.
I did install them as indicated on the npm pages of Argon2. GCC v9 was installed. But, I had repeatedly problems executing:
CXX=g++-9 npm install
I kept getting errors about stdlib++ . I tried using Apple's CLang++ and got a successful build with:
CXX=clang++ npm install
I imported argon2 in my angular project in order to do password hashing and verification. Hashing seems to be working well (no errors) but as soon as I import argon2.verify() and use it in my code (by making a verify-call) I will get an error when trying to execute npm run start. Just trying to start the httpserver secured (ssl/tls) with corresponding private key and certificate.
The error I get is some mysterious error:
ERROR in ./node_modules/node-gyp-build/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/[username-deleted]/WebstormProjects/my-app/node_modules/node-gyp-build'
I have seen comments and complaints on probably similar problems on internet and people referring to some adjustment in a Webpack config file but at this point I dont have this config file in my project. I tried other versions of node-gyp-build but not resolved.
Apparently argon2.hash() (its usage) is working without causing problems, but as soon as I introduce argon2.verify() in my code and run my app with npm run start I get the above error.
Any one with similar problem and how this problem was resolved?
I had the same issue and fixed it by installing the Xcode Command Line Tools:
xcode-select --install
npm upgrade
npm install argon2 --save-dev
Hope it helps.
Installing a new version (0.28.0 and up) fixed it for me

Can't install firebase-admin with npm

I'm trying to run this command to install firebase-admin: npm install firebase-admin --save
When I try to run this command, I get the following error:
ENOENT: no such file or directory, rename 'D:\MyPath\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev' -> 'D:\MyPath\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\.abbrev.DELETE'
I have tried reinstalling Node.js, I have tried uninstalling a previous version of Node.js, I have tried updating npm, I have tried pretty much everything online but nothing is helping. If I run the newest version of Node.js, instead of getting this error, I get the following error:
Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
I have honestly tried several GitHub threads for people with the same problem but none of their solutions have worked for me, so I am trying here. Can anybody help me with this issue?
Upon further tinkering with this, it looks like I finally solved my issue so i can finally deploy to Firebase. These are the steps I took to solve this problem:
First, I uninstalled firebase-admin using the npm uninstall firebase-admin command.
I reinstalled firebase-adming using the npm install firebase-admin command. This didn't seem to fix my issue, but you never know.
I deleted the firebase-admin directory in the node_modules directory.
I ran npm install
I installed the firebase-admin directory again, this time using npm install firebase-admin --save
I ran firebase deploy and it worked!
I don't know how many of those steps were truly necessary but in the end, it worked.
Try to install it using yarn it will get installed smoothly as I faced the same issue while using npm I ran
yarn add firebase-admin and it got easily installed

Cannot find module 'firebase-admin'

I'm trying to push to cloud functions for my iOS app. I followed the Firebase does and installed node in my folder but now I'm getting this error trying to push it up
Error: Error parsing triggers: Cannot find module 'firebase-admin'
UPDATES
Trying to get latest firebase-admin returns invalid
Running npm uninstall firebase-admin
and then running npm install firebase-admin puts out these errors...
I got a similar issue in my project. I solved it by removing the node_modules folder with rm -rf node_modules, then in package.json changing manually the versions for both firebase-functions to 0.7.3 and fire-amin to 5.5.0. After that just run npm install again.

Error with 'babel-runtime' while trying to serve a Meteor app

I have recently been getting off the ground with Meteor and React. I followed the tutorial on the Meteor website with no problem.
Then I tried creating another project, trying to follow another tutorial (for an older version of Meteor). Somewhere along the line, Meteor started throwing up obscure errors. After trying to start fresh again, I ended up reinstalling Meteor and it stopped complaining.
However, I'm getting the same problems, again. Specifically, after creating a brand new project:
meteor create myproject
cd myproject
meteor
The server throws up the following error:
[...]
W20161109-03:53:42.862(1)? (STDERR) Error: The babel-runtime npm package could not be found in your node_modules
W20161109-03:53:42.862(1)? (STDERR) directory. Please run the following command to install it:
W20161109-03:53:42.863(1)? (STDERR)
W20161109-03:53:42.863(1)? (STDERR) meteor npm install --save babel-runtime
[...]
I do what I'm told and attempt to install babel-runtime package. The server manages to successfully get off the ground, but it then throws up the following error at run-time:
Uncaught Error: Cannot find module 'babel-runtime/helpers/slicedToArray'
at Function.require.resolve
This is all still working off a freshly created project, with no extra packages installed or code changed. I have tried looking online for solutions but, while there are lots of references to bugs that have been fixed, I haven't found anything. A couple of (questions)[Babel - Error: Cannot find module 'babel-runtime/helpers/typeof' on StackOverflow have suggested the following:
Reinstalling the NPM modules
rm -rf node_modules
meteor npm install
Updating NPM
meteor npm update -g npm
I am using Meteor 1.4.2, NPM 3.10.9, Ubuntu 16.04.1.
I was having the same issue. After a little digging, found this: https://github.com/meteor/meteor/issues/8019
* Installing the `babel-runtime` npm package in your application
`node_modules` directory is now required for most Babel-transformed code
to work, as the Meteor `babel-runtime` package no longer attempts to
provide custom implementations of Babel helper functions.
Consider trying it out by using the latest release candidate (not officially released yet):
meteor update --release 1.4.2.1-rc.1
And then:
meteor npm install --save babel-runtime
After upgrading to 1.4.2.1-rc.1 (and then subsequently upgrading to 1.4.2.1 this morning 11/9), the error was resolved.
Try adding package.json file inside your project directory and then run
meteor
npm install --save babel-runtime
in the command line.
You may have whitespace in your project name. All that you have to do is create another project without whitespace in the name. I know that it's quite difficult to detect the cause from the error message, but it is what it is.
I recently faced this issue with meteor 1.11.1 and the solutions here did not work. Turns out I had whitespaces in my project name (Ghughu Server V2) and all I had to do is create another one without the spaces (GhughuServerV2).
P.S. It works fine even if you have whitespace in the path to your project, you just can't have whitespace in the project name. Also, just renaming the directory doesn't work. Either you have to create a brand new project or change some configuration inside (which seems impractical if you're working in a newly created project).

Resources