Meteor 'Cannot find module 'crypto' - node.js

I keep getting an error saying "Cannot find module 'crypto'" I am using meteor and from my understanding, npm recently made crypto deprecated and made it built in however, my site now crashes. As a final issue, I cannot revert because I have not installed the module on my computer and it is no longer available on npmjs.org (I believe).
I have tried: updating meteor and npm, reinstalling the package, meteor reset, running an npm install.
Any ideas?

Related

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

Deploy fails with "Error: Can't find npm module" in Meteor Galaxy

I tried to deploy to Meteor Galaxy and it didn´t work at all, although everything seems to be working on localhost.
At first, my app was uploaded, but than failed to start. At least, the containers start right now, but than my App is crashing. I think it is a systematic fail within my app structure. Perhaps some npm dependencies are missing in package.json or I need to debug some npm installations?
I don´t think that I have understood exactly how npm is working within Meteor, which dependencies I need to have or what I have to import/require to use npm packages correctly. The meteor docs did not help.
Here are my error logs:
Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
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.
/app/bundle/programs/server/node_modules/fibers/future.js:280
throw(ex);
^
Error: Can't find npm module 'meteor/browser-policy-common'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
at Object.require (/app/bundle/programs/server/boot.js:230:17)
at makeInstallerOptions.fallback (packages/modules-runtime.js:641:18)
at require (packages/modules-runtime.js:234:16)
at meteorInstall.imports.startup.server.browser-policy.js (imports/startup/server/browser-policy.js:1:32)
at fileEvaluate (packages/modules-runtime.js:333:9)
at require (packages/modules-runtime.js:228:16)
at meteorInstall.imports.startup.server.index.js (imports/startup/server/index.js:1:66)
at fileEvaluate (packages/modules-runtime.js:333:9)
at require (packages/modules-runtime.js:228:16)
at meteorInstall.server.main.js (server/main.js:1:14)
at fileEvaluate (packages/modules-runtime.js:333:9)
at require (packages/modules-runtime.js:228:16)
at /app/bundle/programs/server/app/app.js:3668:1
at /app/bundle/programs/server/boot.js:338:34
at Array.forEach (native)
at Function._.each._.forEach (/app/bundle/programs/server/node_modules/underscore/underscore.js:79:11)
It does not matter which module is missing, it seems to be that Galaxy can´t find any of the used npm modules. Before that try, I had the same error with another npm module. Than I just deleted the Npm.require of that module in my code. Now, I have the same error, just with another module.
I think I missed something during the local usage of npm. I am a complete beginner. Everything worked fine locally and now I can´t bring it online. I am using Windows.
It was a general issue, because I never used the --save flag when adding npm packages and therefore had no dependencies of them in my package.json. I removed node_modules and runned meteor npm install --save for every npm package and the error had been gone (additionally I removed the browser-policy package for other reasons).

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).

react-native : cannot find module 'npmlog'

I am trying to install react native on my windows 7 PC,
but unfortunately an error occurred during installation saying
Error: Cannot find module 'npmlog'
npm install -g react-native-cli //Success
react-native init AwesomeProject//missing module
Note that my node version is 4.3.1
What is missing?!.
It sounds like you possibly have a conflict with your npm version and your node version.
Re-installing node usually solves this issue.
I won't list them all, but a google search of the error will throw up hundreds of results. You can try fixing paths yourself, but generally best just to let the node installer handle it.
Re-installing npm may also resolve the issue
npm install -g npm

nodejs Browserify node-xmpp bundle error: cannot find module dns

I have created a JS bundle file from node-xmpp using Browserify but when I load my website I get the following error in the Google Chrome Javascript console:
Uncaught Error: Cannot find module 'dns'
I tried installing the browser-request node package using npm install -g browser-request and to rebuild the JS bundle but I still get the same error.
What do I need to include/install in order to get rid of this error?
Note: I am using a debian server with the latest version of nodejs and Browserify
I found an commit that has not been added to the latest build yet that solved my problem.
https://github.com/dodo/node-xmpp/commit/a49e7be0e43885060aaf26c2772b41c618624f12
I've added a screenshot containing the changes for if the link dies:

Resources