victory icon indicating copy to clipboard operation
victory copied to clipboard

Failed to parse source map from '[...]/node_modules/victory-core/es/victory-util/hooks/index.js.map' file: Error: ENOENT: no such file or directory, open '[...]/node_modules/victory-core/es/victory-util/hooks/index.js.map'

Open NAJ8ry opened this issue 2 years ago • 2 comments

Following installation into my previously working app I have 159 warnings and the victory charts do not work. All lines appear as the title when I simply type: npm start Failed to parse source map from '[...]/node_modules/victory-core/es/victory-util/hooks/index.js.map' file: Error: ENOENT: no such file or directory, open '[...]/node_modules/victory-core/es/victory-util/hooks/index.js.map'

"victory": "^36.5.3" "react": "^18.0.0",

Node.js v14.19.1

I can uninstall and remove refs to victory everything is fine.

I expected to be able to simply install it with npm install victory

  • OS: Ubuntu 20.04
  • npm: 8.6.0

Have also found others with same issue: https://bytemeta.vip/repo/FormidableLabs/victory/issues/2346

NAJ8ry avatar Jul 25 '22 16:07 NAJ8ry

For thoroughness here is my package.json:

{
  "name": "ss-ntt-ui",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": ">=14.19.0",
    "npm": ">=8.6.0"
  },
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^14.3.0",
    "autoprefixer": "10.4.7",
    "bootstrap": "^5.2.0",
    "chokidar": "^3.5.3",
    "date-fns": "^2.29.1",
    "formik": "^2.2.9",
    "just-debounce-it": "^3.0.1",
    "npm": "^8.15.0",
    "nth-check": "^2.1.1",
    "react": "^18.2.0",
    "react-bootstrap": "^2.4.0",
    "react-datetime-picker": "^3.5.0",
    "react-dom": "^18.2.0",
    "react-icons": "^4.4.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^5.0.1",
    "react-tabs": "^5.1.0",
    "sass": "^1.54.0",
    "web-vitals": "^2.1.4",
    "yup": "^0.32.11"
  },
  "overrides": {
    "autoprefixer": "10.4.7"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.31.0",
    "@typescript-eslint/parser": "^5.31.0",
    "eslint-plugin-react": "^7.30.1"
  }
}

NAJ8ry avatar Jul 26 '22 12:07 NAJ8ry

I had the same issue, looks like all sourcemaps are missing from the published package. The build scripts do generate the sourcemaps though. After some investigating I was able to track down this commit https://github.com/FormidableLabs/victory/commit/345d364d131d62bc5657b253b6df3449d8087927 where *.map was added to the .npmignore file in each package. This results in npm not including those files in the tarball file it creates when publishing. I don't know why this was done but it looks like it was a mistake...?

rvanmil avatar Jul 28 '22 13:07 rvanmil

Any update to this bug or workaround?

gbspr avatar Aug 18 '22 20:08 gbspr

Thanks for posting this issue, I just started investigation!

scottrippey avatar Aug 18 '22 20:08 scottrippey

Research note:

CRA makes the decision to reach into node_modules for source maps here: https://github.com/facebook/create-react-app/blob/main/packages/react-scripts/config/webpack.config.js#L352-L358

And this is not easily overridable without it seems disabling sourcemaps entirely.

It does look like CRA has an open PR to just ignore all sourcemaps loading issues from node_modules here.

ryan-roemer avatar Aug 18 '22 21:08 ryan-roemer

I'm going to close this as a duplicate of #2346 -- please track all progress there

scottrippey avatar Aug 18 '22 22:08 scottrippey