question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with Next.js

See original GitHub issue

Describe the bug

error - ./node_modules/react-js-cron/dist/esm/styles.css
Error: ENOENT: no such file or directory, open '/Users/tmorrow/repo/iot/node_modules/react-js-cron/dist/esm/styles.css'

To Reproduce Try to use this library in a nextjs project

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
xrutayisirecommented, Jun 26, 2022

Hello,

Did it! 🥳

I removed the internal import of a CSS file inside the component. You should now be able to use this package without any problem with Next.js.

Please let me know if there are any other issues.

You can install the version 2.0.0 and don’t forget to import manually the styles file, as mentioned in the README

1reaction
lacymorrowcommented, Mar 21, 2022

Repo is here: https://github.com/lacymorrow/next-cron

Run yarn and yarn dev and visit http://localhost:3000 to reproduce the issue, error is in the terminal

I just used yarn create next-app --typescript to generate a NextJS project, then yarn add react-js-cron antd to add dependencies, then added the <Cron> component to the index.tsx page.

The error is as follows:

error - ./node_modules/react-js-cron/dist/esm/styles.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/react-js-cron/dist/esm/Cron.js

Latest versions of react-js-cron, antd, and next

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Tailwindcss not working with next.js; what is wrong ...
In my case, I had set up the Tailwind config file correctly, but tailwind styles were not applying. Deleting the .next folder and...
Read more >
TailwindCSS not working in NX NextJS project. #8355 - GitHub
Current Behavior Following the egghead tutorial for a NextJS project with a new nx-workspace, installing Tailwind is not working.
Read more >
Debugging Tailwind CSS and Next.js - LogRocket Blog
Using Tailwind CSS and Next.js together can be a powerful match, sometimes a few bugs get in the way. Learn to fix them...
Read more >
module-not-found - Next.js
The module you're trying to import uses Node.js specific modules, for example dns , outside of getStaticProps / getStaticPaths / getServerSideProps. Possible ...
Read more >
next.config.js: Introduction
Avoid using new JavaScript features not available in your target Node.js version. next.config.js will not be parsed by Webpack, Babel or TypeScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found