Comments (23)
Sure, thanks. I'll keep trying, if I find any solution I post here.
from image-to-base64.
@renanbastos93 I couldn't solve it
from image-to-base64.
Wow, =/
What's version your NodeJS?
Do you this use in Node or browser?
from image-to-base64.
$ node --version
v8.11.3
I use Node
from image-to-base64.
I'll update node and try again.
from image-to-base64.
It's okay.
Well, Can you send the log full to I understand what is this error?
from image-to-base64.
I did update node and still with the same problem.
ERROR in ./~/image-to-base64/image-to-base64.min.js
Module not found: Error: Can't resolve 'fs' in 'D:\Projetos\...\pwa\node_modules\image-to-base64'
resolve 'fs' in 'D:\Projetos\...\pwa\node_modules\image-to-base64'
Parsed request is a module
using description file: D:\Projetos\...\pwa\node_modules\image-to-base64\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
after using description file: D:\Projetos\...\pwa\node_modules\image-to-base64\package.json (relative path: .)
resolve as module
D:\Projetos\...\pwa\node_modules\image-to-base64\node_modules doesn't exist or is not a directory
D:\Projetos\...\pwa\node_modules\node_modules doesn't exist or is not a directory
D:\Projetos\...\node_modules doesn't exist or is not a directory
D:\Projetos\node_modules doesn't exist or is not a directory
D:\node_modules doesn't exist or is not a directory
looking for modules in D:\Projetos\...\pwa\node_modules
using description file: D:\Projetos\...\pwa\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: D:\Projetos\...\pwa\package.json (relative path: ./node_modules)
using description file: D:\Projetos\...\pwa\package.json (relative path: ./node_modules/fs)
no extension
Field 'browser' doesn't contain a valid alias configuration
D:\Projetos\...\pwa\node_modules\fs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
D:\Projetos\...\pwa\node_modules\fs.js doesn't exist
.vue
Field 'browser' doesn't contain a valid alias configuration
D:\Projetos\...\pwa\node_modules\fs.vue doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
D:\Projetos\...\pwa\node_modules\fs.json doesn't exist
as directory
D:\Projetos\...\pwa\node_modules\fs doesn't exist
[D:\Projetos\...\pwa\node_modules\image-to-base64\node_modules]
[D:\Projetos\...\pwa\node_modules\node_modules]
[D:\Projetos\...\node_modules]
[D:\Projetos\node_modules]
[D:\node_modules]
[D:\Projetos\...\pwa\node_modules\fs]
[D:\Projetos\...\pwa\node_modules\fs.js]
[D:\Projetos\...\pwa\node_modules\fs.vue]
[D:\Projetos\...\pwa\node_modules\fs.json]
[D:\Projetos\...\pwa\node_modules\fs]
@ ./~/image-to-base64/image-to-base64.min.js 1:274-287
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/pages/Plants.vue
@ ./src/pages/Plants.vue
@ ./src/pages lazy ^\.\/.*\.vue$
@ ./src/main.js
@ multi ./build/dev-client babel-polyfill ./src/main.js
from image-to-base64.
Do you use vue.js
right?
So, I need a help to create tests to this case.
This library run good with vanillaJS and NodeJS, now with some frameworks, I need help to make tests and resolve problems.
I think now, we can testing import the library in tag HTML, and using lib normally. Can be?
<script src="node_modules/image-to-base64/image-to-base64.min.js"></script>
from image-to-base64.
Yes, I use Vue. How do I use the lib when I import in HTML?
I added this line, but how do I test?
from image-to-base64.
If I add:
import image2base64 from 'image-to-base64'
or
const image2base64 = require('image-to-base64')
to my JS files
with this import in HTML, the same error still appearing.
from image-to-base64.
On component that you'll using, should use this example code:
imageToBase64("https://whatever-image/")
.then(
(response) => {
console.log(response); //iVBORw0KGgoAAAANSwCAIA...
}
)
.catch(
(error) => {
console.log(error); //Exepection error....
}
)
you can pass url or path relative.
Don't impot on Node, Try using as vanillaJS.
Understood?
from image-to-base64.
yep
Uncaught ReferenceError: imageToBase64 is not defined
at (index):64
and
Uncaught ReferenceError: image2base64 is not defined
at (index):64
didn't work
from image-to-base64.
I will to try using Vue.JS and find errors to understand how run to create a fix. However I don't can today.
from image-to-base64.
Nice, if you wish can open a PR with your solution.
from image-to-base64.
@lcardosozago you did it?
from image-to-base64.
Hi I also have the same question on React Native. I want to convert image from URL to base64 and following error comes,
Failed to load bundle(http://localhost:8081/index.ios.bundle?platform=ios&dev=true) with error:(Unable to resolve module fs
from /Users/dileepa/projects/xxx/mobile/node_modules/image-to-base64/image-to-base64.min.js
: Module fs
does not exist in the Haste module map
This might be related to facebook/react-native#4968
To resolve try the following:
- Clear watchman watches:
watchman watch-del-all
. - Delete the
node_modules
folder:rm -rf node_modules && npm install
. - Reset Metro Bundler cache:
rm -rf /tmp/metro-bundler-cache-*
ornpm start -- --reset-cache
. - Remove haste cache:
rm -rf /tmp/haste-map-react-native-packager-*
. (null))
__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.248
RCTCxxBridge.mm:429
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
_dispatch_client_callout
_dispatch_block_invoke_direct
_dispatch_client_callout
_dispatch_block_invoke_direct
dispatch_block_perform
__NSOQSchedule_f
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread3
_pthread_wqthread
start_wqthread
from image-to-base64.
Same problem trying to use the library in Angular 8. Any development on this bug?
from image-to-base64.
Hey @renanbastos93
I'm having the same issue with the fs lib when I tried to publish a npm package from a react library, and I solved it by removing the nodejs code from the library so ... maybe the solution will be to split the code in 2 separate versions, one for browser and the other one for node
from image-to-base64.
Wow, interesting. So, can you open a pull request making this change?
Today, I am without time to commit to this project I am accepting help.
from image-to-base64.
@gubagu @dilipchandima @lcardosozago
Hello, was fixed it. Special thanks to @aqrojo to implemented the fix.
Already was published on NPM
from image-to-base64.
Hi
I'm afraid still facing this issue, I'm using angular 9.
ERROR in ./node_modules/image-to-base64/image-to-base64.min.js
Can't resolve 'fs' in 'filepath/imagetobase64'
ERROR in ./node_modules/image-to-base64/image-to-base64.min.js
Can't resolve 'path' in 'filepath/imagetobase64'
from image-to-base64.
@aviralgoyal try to use this with the latest version:
import imageToBase64 from 'image-to-base64/browser';
from image-to-base64.
Hi @aqrojo
Worked Perfectly! Thank you so much for the prompt reply. I had found a workaround, so I just got around testing it right now.
Is it mentioned somewhere in the documentation? It would be super easy next time someone faces the same issue!
Thanks a ton
Aviral
from image-to-base64.
Related Issues (20)
- Invalid base 64 string [Help Wanted] HOT 1
- one typo in README.md HOT 3
- is there way I can run it synchronously? HOT 5
- Error message not meaningful HOT 3
- Cors-Policy Error HOT 1
- Typescript support HOT 5
- how to solve ERR_UNESCAPED_CHARACTERS error? HOT 6
- Create a new release and publish on NPM HOT 1
- e.buffer is not a function HOT 9
- How to return the Base64 from object imageToBase64 HOT 1
- statSync issue due to too large image size HOT 9
- don't have time to take care of him, Can someone take care of it? HOT 3
- invalid regular expression in safari HOT 6
- Cannot find module 'fs' in 'image-to-base64' HOT 4
- CORS error when using imageToBase64 HOT 1
- Cannot find module 'fs' in 'image-to-base64' HOT 1
- Invalid regular expression: invalid group specifier name HOT 2
- Base64 image converter is not valid HOT 5
- CORS policy: No 'Access-Control-Allow-Origin' in react js HOT 1
- Blank Page in Safari : Create React APP project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image-to-base64.