Hello,
I apologize if this has beed answered before, but I couldn’t find any answer to how to fix this. I am very new to Matomo so maybe I’m missing something… I am following all the steps on the official NPM page and I get this result:
Create a new React app: create-react-app app --template typescript
npm i -S @datapunt /matomo-tracker-react
index.tsx:
import { createInstance, MatomoProvider } from “@datapunt /matomo-tracker-react”;
const instance = createInstance({
urlBase: ‘http://localhost:3000 ’,
siteId: 1
})
ReactDOM.render(
<React.StrictMode>
</React.StrictMode>,
document.getElementById(‘root’)
);
App.tsx
import { useMatomo } from “@datapunt /matomo-tracker-react”;
function App() {
const { trackPageView, trackEvent } = useMatomo();
trackPageView({
documentTitle: ‘Index page’
});
const handleOnClick = () => {
trackEvent({ category: ‘sample-page’, action: ‘click-event’ })
}
return (
Click me
)
}
export default App;
Run the app.
Every time I run the app I get a bunch of these console logs:
…
WARNING in ./node_modules/@datapunt /matomo-tracker-react/es/utils/useOutboundClickListener.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from ‘C:\Users\leikin\WebstormProjects\matomo-app\node_modules@datapunt\matomo-tracker-react\src\utils\useOutboundClickListener.tsx’ file: Error: ENOENT: no such file or directo
ry, open ‘C:\Users\leikin\WebstormProjects\matomo-app\node_modules@datapunt\matomo-tracker-react\src\utils\useOutboundClickListener.tsx’
@ ./node_modules/@datapunt /matomo-tracker-react/es/useMatomo.js 3:0-72 14:6-30
@ ./node_modules/@datapunt /matomo-tracker-react/es/index.js 4:0-51 4:0-51
@ ./src/index.tsx 9:0-80 11:17-31 16:33-47
…
Can anyone sine some light as to why this is happening?
Any help will be very much appreciated.
Lukas
(Lukas Winkler)
March 3, 2022, 5:02pm
2
Just FYI,
@datapunt/matomo-tracker-react
is not “the official NPM” module of Matomo (there doesn’t exist one maintained by the Matomo team), but is maintained by the city of Amsterdam. Nevertheless it seems like the best way to integrate Matomo with react.
For your issue, you might want to look here:
opened 01:13PM - 16 Dec 21 UTC
closed 01:45PM - 20 Jan 22 UTC
**Describe the bug**
I recently updated my project which uses CRA to v5.0.0.
B… ut when I start the project. I get the following warnings.
Though tracking is working fine I just wanted to flag this warnings.
```shell
WARNING in ./node_modules/@datapunt/matomo-tracker-js/es/MatomoTracker.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/MatomoTracker.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/MatomoTracker.ts'
@ ./node_modules/@datapunt/matomo-tracker-js/es/index.js 1:0-44 3:15-28
@ ./node_modules/@datapunt/matomo-tracker-react/es/instance.js 1:0-56 4:13-26
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 3:0-55 3:0-55
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-js/es/constants.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/constants.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/constants.ts'
@ ./node_modules/@datapunt/matomo-tracker-js/es/MatomoTracker.js 12:0-42 183:15-38 202:15-39 216:25-47 223:13-35 268:13-46 276:25-64
@ ./node_modules/@datapunt/matomo-tracker-js/es/index.js 1:0-44 3:15-28
@ ./node_modules/@datapunt/matomo-tracker-react/es/instance.js 1:0-56 4:13-26
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 3:0-55 3:0-55
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-js/es/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/index.ts'
@ ./node_modules/@datapunt/matomo-tracker-react/es/instance.js 1:0-56 4:13-26
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 3:0-55 3:0-55
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-js/es/types.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/types.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-js/src/types.ts'
@ ./node_modules/@datapunt/matomo-tracker-js/es/index.js 2:0-33 4:0-17
@ ./node_modules/@datapunt/matomo-tracker-react/es/instance.js 1:0-56 4:13-26
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 3:0-55 3:0-55
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-react/es/MatomoContext.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/MatomoContext.tsx' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/MatomoContext.tsx'
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 1:0-59 1:0-59
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-react/es/MatomoProvider.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/MatomoProvider.tsx' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/MatomoProvider.tsx'
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 2:0-61 2:0-61
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-react/es/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/index.ts'
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-react/es/instance.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/instance.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/instance.ts'
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 3:0-55 3:0-55
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-react/es/useMatomo.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/useMatomo.ts' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/useMatomo.ts'
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 4:0-51 4:0-51
@ ./src/index.tsx 24:0-64 52:33-47
WARNING in ./node_modules/@datapunt/matomo-tracker-react/es/utils/useOutboundClickListener.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/utils/useOutboundClickListener.tsx' file: Error: ENOENT: no such file or directory, open '/Users/nick/project-cra-5/node_modules/@datapunt/matomo-tracker-react/src/utils/useOutboundClickListener.tsx'
@ ./node_modules/@datapunt/matomo-tracker-react/es/useMatomo.js 3:0-72 14:6-30
@ ./node_modules/@datapunt/matomo-tracker-react/es/index.js 4:0-51 4:0-51
@ ./src/index.tsx 24:0-64 52:33-47
10 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.65.0 compiled with 10 warnings in 93372 ms
No issues found.
```
**To Reproduce**
Steps to reproduce the behavior:
Create a new project with create-react-app v5 with typescript
Add Matomo dependencies
Configure matomo instance
yarn start / npm start
Also, you can fork from the sandbox and test it on your local
https://codesandbox.io/s/7ner9
**Expected behavior**
I think this warning should be fixed
Thanks!
and
opened 04:05PM - 31 Jan 22 UTC
There are several bug fixes that haven't been published to NPM (last publish was… 6 months ago v0.5.1). Maybe using a GitHub action to automatically publish the packages on merge to main is the way to go.
I found this example:
https://github.com/azu/lerna-monorepo-github-actions-release
Related issues: #711 #666
1 Like