Failed to resolve module specifier "date-fns".
See original GitHub issueHi, I received this message:
Uncaught TypeError: Failed to resolve module specifier “date-fns”. Relative references must start with either “/”, “./”, or “…/”. in my Chrome console when I tried:
import {format} from 'date-fns'
This is my first time installing a package instead of running on cdn, and I would love to get it to work.
Many thanks! Ken
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Module not found: Error: Can't resolve 'date-fns/addDays' in 'C ...
You need to install the date-fns package from NPM using npm install --save date-fns .
Read more >Cannot find module 'date-fns' error | bobbyhadz
To solve the error "Cannot find module 'date-fns'", make sure to install the date-fns package by opening your terminal in your project's root...
Read more >failed to resolve module specifier "axios". relative references ...
I get Uncaught TypeError: Failed to resolve module specifier "axios". Relative references must start with either "/", "./", or ". Favicon for you.com ......
Read more >Failed to resolve module specifier | by Sami C. - Medium
Failed to resolve module specifier. Today I got stuck when trying to load a module: import(`folder/myModule.js`).then((response) => ...
Read more >date-fns-tz - npm
Time zone support for date-fns v2 with the Intl API. ... property in your project's package.json to either module , for ESM, or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Alright! @ken-1998 You can use the CDN from date-fns in your page.html, like this:
and in
sample.js
call the library with the worddateFns
.You will use date-fns package from npm-package in projects like node-js, react, vue, angular, etc. It’s not recomended use that approach to simple html pages because the package works like a module, e.g ES6, and the browser dont read ES6, you’ll need a Babel transpiler to convert ES6 code to JS native code.
See more info here.
I see! Thank you @maximillianfx ! Have a great weekend!