I want to add Linking images feature to my React app that uses '
#ckeditor/ckeditor5-build-decoupled-document
code:
import React from 'react'
import { CKEditor } from "#ckeditor/ckeditor5-react";
import * as DecoupledEditor from "#ckeditor/ckeditor5-build-decoupled-document";
but when I import:
import linkimage from '#ckeditor/ckeditor5-link/src/linkimage';
I get an error:
Uncaught CKEditorError: ckeditor-duplicated-modules
more info about images linking
How can I add linking images?
I assume you have done:
npm install --save #ckeditor/ckeditor5-image
and enabled the plugin with:
import LinkImage from '#ckeditor/ckeditor5-link/src/linkimage';
then add this into your editor config:
image: {
toolbar: [
'imageStyle:block',
'imageStyle:side',
'|',
'toggleImageCaption',
'imageTextAlternative',
'|',
'linkImage' <---- here
]
}
even if the error still persist, try the error code docs for it here
Packages were duplicated in node_modules
In some situations, especially when calling npm install multiple times, it may happen that npm will not correctly "deduplicate" packages.
Normally, npm deduplicates all packages so, for example, #ckeditor/ckeditor5-core is installed only once in node_modules/. However, it is known to fail to do so from time to time.
We recommend checking if any of the steps listed below help:
rm -rf node_modules && npm install to make sure you have a clean node_modules/ directory. This step is known to help in most cases.
If you use yarn.lock or package-lock.json, remove it before npm install.
Check whether all CKEditor 5 packages are up to date and reinstall them if you changed anything (rm -rf node_modules && npm install).
Related
I installed firebase-admin in my React project, and suddenly I am getting a ton (116 to be exact) of "Module Not Found Errors" when loading the page - 'stream', 'util', 'assert', 'url', 'crypto' and the list goes on and on. Not sure what happened. I tried removing firebase-admin from the package.json file, but that did not fix the errors.
Any suggestions? The app was working fine until I installed firebase-admin.
Try this and see if it fix your problem:
Remove your node_modules folder (rm -rf node_modules)
npm cache clean -f
npm install
npm install firebase-admin
The errors seem to stem from the following import line:
import { firestore } from 'firebase-admin';
I am following the fontawesome documentation on how to add icons with react.
https://fontawesome.com/v6/docs/web/use-with/react/add-icons
I have added babel.config.js and babel-plugin-macros.config.js files in my root directory. Code for both of those file could be viewed in the documentation link attached.
I am getting the error as:
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
for various types of caching, using the first param of their handler functions:
i added api.cache(true) in my babel.config.js file but still the error persists.
Can anyone identify why this error is showing up?
I had the same issue, if you used create-react-app you could try ejecting the project and following the steps (I failed), but the way I got it to work is to follow https://fontawesome.com/v6/docs/web/use-with/react/
npm i --save #fortawesome/fontawesome-svg-core
npm i --save #fortawesome/free-solid-svg-icons
npm i --save #fortawesome/free-regular-svg-icons
npm i --save #fortawesome/react-fontawesome#latest
import { FontAwesomeIcon } from '#fortawesome/react-fontawesome';
import { faGear } from '#fortawesome/free-solid-svg-icons';
const gearIcon = <FontAwesomeIcon icon={faGear} />
...
render(<> {gearIcon} </>);
Whenever I install any gatsby plugins or typography files, and then attempt to run gatsby develop, I am thrown an error sying that 'react' can't be found. Example:
I create a new gatsby site using gatsby new example-site https://github.com/gatsbyjs/gatsby-starter-hello-world
I install the gatsby-plugin-sass using npm install --save node-sass gatsby-plugin-sass
I follow the instructions on the plugin page, adding the plugin to my gatsby-config.js file.
When I now attempt to run gatsby develop I receive the following errors:
ERROR
There was a problem loading the local develop command. Gatsby may not be installed. Perhaps you need to run "npm install"? Cannot find module 'react'
Error: Cannot find module 'react'
As well as a list of files that the errors are being thrown in, most of them in internal files.
Clearly I have the Gatsby-cli installed, as well as react. I'm also receiving a ton of warnings about deprecated related to core-js and optional dependencies not being installed.
In my research, I have found people saying that using yarn instead of npm solves the issue, but with Gatsby being as large of a project as it is, and with the documentation itself saying to use npm, that doesn't seem like a solution but rather a work around. Is there any other info on this that I just can't seem to find?
I reprodued your error, and after looking around I found several issues on the Gatsby GitHub repo with the same behavior.
It seems that this is a problem with npm itself, which is why the community is increasingly switching to yarn.
If you'd like to stick with npm, the solution is to clear your node_modules and package-lock.json, then reinstall your dependencies (source):
rm -rf node_modules/ package-lock.json
npm install
In my React app, which was built using create-react-app, I'm getting the error:
Module not found: Can't resolve 'react-icons/io' in '/usr/src/app/src/components/analytics_components'.
The app has been working fine for a while but I just rebuilt it using Docker Compose and now it's not.
It seems like it's looking in the wrong directory, src instead of node_modules.
react-icons is definitely installed, npm list react-icons returns its version number.
I can see the io folder in node_modules/react-icons
The import statement:
import { IoMdList } from "react-icons/io";
When I change the import to explicitly point to the node_modules directory, it works, but I didn't need to do this before nor do I need to for any other packages, which are still all working correctly:
import { IoMdList } from "../../../node_modules/react-icons/io";
I just reinstall the command npm install react-icons and then it works.
Again you can install npm if you already installed that doesn't matter you can re-install your npm again without deleting current node module. it works for me. command: npm install
you can try delete your node module folder and run cmd:npm install or yarn install it may solve your problem
I created a native module and created another project to test it locally.
Here are my steps:
cd <Testing project>
npm install ../<Module project>
react-native link <module name>
react-native run-android
Then I got following error:
error: bundling failed: Error: Unable to resolve module `react-native-helloworld` from `G:\Test\App.js`: Module `react-native-helloworld` does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
I've searched StackOverflow for the issue, but there's no workable solution. The suggested solution 'clear the cache and reset everything' cannot work.
However, the module can work if I publish it to https://www.npmjs.com/ and then install it via npm install <module name>.
The only difference is the installing way.
I got a similar error complaining about how it could not find 'path' from where ever it was looking for. In the end I figured out that the issue was completely unrelated.The following auto import was accidentally added to my code (probably when I was creating a style using 'textTransform')
import { transform } from "#babel/core";
Once I noticed that and removed it, the project was buildable. It might help to check recent changes in your code to see if something similar got added.
Chances are that you're accidentaly symlinking your library inside node_modules when you use npm, instead of using npm you can use yarn
yarn add file:../<module_project>