Module not found: 'draft-js-export-html' - reactjs

I'm working on a new project with draft.js and have been needing to export raw HTML from my editor. I want to be able to render in another component the HTML as the user is typing.
I did find a nice module to do it, but my app seems not to be able to import the
Error in ./src/App.js Module not found: 'draft-js-export-html' in C:\Use
It seems to be installed correctly:
$ npm draft-js-export-html -v
3.10.10
and I'm importing it to my project:
import {stateToHTML} from 'draft-js-export-html';
Is there something I'm doing wrong?

npm draft-js-export-html -v
will not print the version of the installed package but the installed version of npm itself.
draft-js-export-html has no such version as 3.10.10. The latest version is 1.4.1.
Try
npm install -s draft-js-export-html
If it is already installed this will have no effect.

Related

Can't import the named export 'PublicKey' from non EcmaScript module (only default export is available)

Describe the bug
Hi, I'm trying using Metaplex to upload the assets and verify the collection, I am now moving towards "Minting Website": https://docs.metaplex.com/candy-machine-v2/mint-frontend
run rpm start inside the folder ~/metaplex/js/packages/candy-machine-ui to test the mint button, it doesn't load the localhost and it shows me the following error on the terminal:
Failed to compile.
./node_modules/#solana/buffer-layout-utils/lib/esm/web3.mjs
Can't import the named export 'PublicKey' from non EcmaScript module (only default export is available)
Anyone know how to solve this? thanks
I'm using Visual Studio on Windows, node 14.15.
Update:
It seems I'm not alone:
https://github.com/solana-labs/buffer-layout-utils/issues/6
Solved it:
How to downgrade the version of Solana to 1.9.1
For some reason yarn install wasn't doing it for me like in the docs.
I deleted node_module, package-lock.json and yarn.lock then installed with npm instead
npm install && npm start
that worked for me

Box shadows with html2canvas - installing build from git

The documentation for the main version of html2canvas says it does not currently support box shadows, but there are existing versions that do. This page showcases html2canvas working with box shadows working box shadows
I want to add this version to my project and tried
npm install --save https://github.com/niklasvh/html2canvas.git
which adds this line to my package.json file
"html2canvas": "git://https://github.com/niklasvh/html2canvas.git",
but when I try to import html2canvas with
import html2canvas from 'html2canvas';
it gives the error
Module not found: Can't resolve 'html2canvas'
I've never used a library or npm package straight from git before - what am I doing wrong?
try username/repository#branch in package.json
or try npm install --save username/repo#branch-name.
In your case npm install niklasvh/html2canvas#master.
Please let me know if it does not solve your problem.

Import error for react-icons. Module not found: Can't resolve 'react-icons/io' in '/usr/src/app/src/...'

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

Where can i find react components installed using npm?

I would like to use the react-drag-sortable components (https://www.npmjs.com/package/react-drag-sortable) which i successfully installed as follows:
npm install react-drag-sortable
The issue is, my application doesn't recognize when i import this component. Where does this component physically reside after running the npm install command? How can I then use it in my application?
This is not about installing packages (Where does npm install packages?)
It's in node-modules/react-drag-sortable/lib/index.js
It's exported with the following line at the end of the file:
exports.default = DragSortableList;

Using React Dev Tools with Preact

I have just got preact-redux-example up and running, and now I am attempting to use Preact Dev Tools in my app.
Based on this post I assumed it was a case of adding
import 'preact/devtools'
into the entry point (app.js) file.
However, this yields the following error:
./src/components/app.js
Module not found: Error: Cannot resolve module 'preact/devtools'
Is there something else I need to install, or am I on the wrong track?
preact/devtools has landed in version 6.4.0, but the example project uses version 4.8.0. So you need to upgrade the preact version to be able to import it:
npm install --save preact#latest
Or if you're using yarn you can run:
yarn upgrade preact

Resources