Cloudinary node.js plugin in Vue.js SPA project
Is there any way to use the plugin in a Vue.js app? I've installed it via npm, but get errors when I require/import it:
ERROR in ./~/cloudinary/lib/uploader.js
Module not found: Error: Can't resolve 'fs' in '/my_projects/vue-app/node_modules/cloudinary/lib'
@ ./~/cloudinary/lib/uploader.js 23:7-20
@ ./~/cloudinary/cloudinary.js
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./assets/js/components/Category.vue
@ ./assets/js/components/Category.vue
@ ./assets/js/routes.js
@ ./assets/js/app.js
Is there some dependency or webpack loader/plugin that I am missing, or am I going to have to bite the bullet and use the JQuery method?
-
Hi Ian,
Seems that what you really need here is the cloudinary-core package rather than the Node.js one. Could you try `npm install cloudinary-core` instead?
Let me know if this helps solving this issue.
0 -
That's just what I was looking for. Thanks
0 -
I'm having a similar problem with this. I've installed cloudinary-core.
Error during compile:
This dependency was not found:
* fs in ./~/cloudinary/lib/uploader.js
To install it, you can run: npm install --save fsand "npm install --save fs" doesn't help.
Well, maybe not. If I include nothing, I'm able to compile and upload just fine.
0 -
Hi Jeff,
When you said "cloudinary-core", did you refer to https://github.com/cloudinary/pkg-cloudinary-core ?
Because if so, then note that this is a JavaScript library rather than a Node.js one.
0 -
No, I just pulled it in via node, but that wasn't the problem. It was my lack of skills using Vue. Based on internet searches, I believed I would have to use "import cloudinary..." in my Vue component. I ended up removing the import to get it to compile and then I found that it worked fine without an import.
0 -
Thanks a lot for the update, I'm glad it's working for you now :)
0
Post is closed for comments.
Comments
6 comments