how can i find a replacement for fs?
i am using the itunes APN from npm (npm install apn) but it uses the fs module. I spend many hours on research and some suggested i had this to my webpack config
node: {
'fs': empty
}
this prevents any errors but it obviously breaks the code so as far as i am concerned is not a solution at all.
I tried using fs-extra but this requires graceful-fs which in turns requires again the good old 'fs' module. So we are going in circles. How can i solve this please?
Related
I'm pretty new with NodeJS and I'm trying to use a module called "updated-node-msmq" (from this repository) in my project but getting an error.
What I've done:
I opened a new folder for the project.
I used the command "$ npm install --save updated-node-msmq" and got some warnings (Screenshot attached).
When I try to use the module according to the README, and run my "test.js" file I got the following error here in the screenshot).
I am using version 14.16.0 of NodeJS and after trying to fix this myself I realized that probably the problem is that the module was built for older versions of NodeJS.
I understand that low version is not a recommended solution, but I have no clue how to update a module.
Help / guidance in solving the problem?
Thanks in advance everyone!
Why are you using updated-node-msmq? That package seems like a mess, and the errors you are getting is because the whole module is written with ES2015 but doesn't seem to have been transpiled to node.js compatible code before published to NPM.
I'd advise you to use a tried and tested module for MSMQ first and foremost.
EDIT: Seems like the author fucked up in the 0.2.0 version. You could use the 0.1.9 (by instead using npm install updated-node-msmq#0.1.9 but that one is 3 years old.
I am trying to use node Crypto module in Angular 7 for asymmetric encryption.
and used below command to import the Crypto module
import * as crypto from 'crypto';
but still I am getting error that is
`ERROR in src/app/log-in/log-in.component.ts(11,25): error TS2307: Cannot find module 'crypto'.`
Please help me to resolve the error that how to use this library into Angular.
Thanks in Advance.
I was trying to import { randomBytes } from "crypto"; then such error occurred,
I installed node types npm install #types/node --save-dev and it was resolved.
Per the author on npm , The crypto package is no longer available as it is now built in to Node.js. I would suggest looking for an alternative. I came across a Github Gist that contains some suggestions: https://gist.github.com/jo/8619441
Make sure whatever you pick is useable in the browser. Some of the options listed there are server-side only.
Make sure that you install 'crypto' module from npm
use: npm i crypto to install this module.
for more information please visit here.
If this is still not working then you have to check for alternative module because this module is dedicated you can check this
I am trying to add the request module to fetch some data, but I am having trouble, given, that it somehow relies on the fs module
Installing it and requiring it lands me this error:
This dependency was not found: fs, tls, net
To install it, you can run: npm install --save fs tls net
Installing tls and net seems to fix them (as they don't appear after that) but the fs issue remains. I've checked multiple issues about Webpack and request, but modifying my webpack config didn't help much.
How can I get request to work in a Gatsby website?
Thank you and good day
Request doesn't work on the frontend.
Use https://github.com/axios/axios instead.
They have a Pandorabots API module for Node.js. After installing it and runnig the app I get Could not find module 'fs'. Thank you for any insight.
Thanks for asking
I have studied whole pandorabots docs but did not get any error like you are getting and my given code can only solve the problem for "fs"
if you are interested then, you can use that
$ npm install fs --save
var fs =require('fs');
I am attempting to install localForage into a node.js application (with Angular) and Browserify.
Here is a link to the localForage documentation
It appears that using localForage and angular-localForage causes a problem with browserify based around the use of 'require'
If I require the localforage.js file in the src file I get the following error:
Warning: module "promise" not found from "/Users/mgayhart/Sites/epson- receipts/bower_components/localforage/src/localforage.js" Use --force to continue.
If I require the localforage.js file in the dist file, I get the following error:
Warning: module "./drivers/indexeddb" not found from "/Users/mgayhart/Sites/epson- receipts/bower_components/localforage/dist/localforage.js" Use --force to continue.
Anyone know of a workaround to be able to move forward with these libraries?
There is an issue on github with this problem: https://github.com/ocombe/angular-localForage/issues/26
I'll be working on it soon, you can subscribe to the github notifs on this issue to know when it's fixed !
For me installing it through bower and using it with browserify-shim worked. So in package.json:
"browser": {
"localforage":"./src/lib/vendor/localforage/dist/localforage.min.js"
},
"browserify-shim": {
"localforage":"localforage"
}
And to expose it as an angular-service (if you don't want to use angular-localforage):
app.factory "localforage",-> require 'localforage'
I've just been having this issue myself tonight, but I think I found a fix.
Instead of trying to get the bower modules to work with browserify, why not just use npm like its made for?
npm install localforage
and then when you use require you don't have to give it the path
but it still didn't work for me until I copied the folder:
localforage/src/drivers TO localforage/dist/drivers
Then it found all the dependencies and worked like a champ!
Alternatively if you must use bower you could try to use the debowerify tranform w/ gulp:
https://github.com/eugeneware/debowerify