Closed ShootDot closed 3 years ago
This usually means you have mismatched node-canvas and Node.js architectures (32 vs. 64 bit).
Can you please post:
# in your shell
node -p "process.arch"
and
// save in a file and run with node
const fs = require("fs");
const path = require("path");
const cnode = path.join(require.resolve("canvas"), "../build/Release/canvas.node");
const fd = fs.openSync(cnode);
const b = Buffer.alloc(4);
fs.readSync(fd, b, 0, 4, 60);
const pe_addr = b.readUInt32LE(0);
fs.readSync(fd, b, 0, 2, pe_addr + 4);
const type = b.readUInt16LE(0);
console.log(type.toString(16));
That will print one of the values here, which should be 8664 (64-bit) or 14c (32-bit).
(See also #1533, #1370.)
`const cnode = path.join(require.resolve("canvas"), "../build/Release/canvas.node"); ^
ReferenceError: path is not defined` @zbjornson
@aman78600 sorry, I missed a line. I edited my previous comment, can you try it again please?
I got 8664
Now what should I do ?
@zbjornson
Can you post node -p "process.arch"
too please?
Here you go
If you have discord please try to message me their. Thanks Shoot.Dot#0641
@zbjornson Please Help
Can you provide the info that was in the issue template please? (OS, Node.js version, Canvas version) Trying to run on WinXP is another possible cause. You can drop canvas.node into dependency walker to hopefully get a more useful error. This is tricky to troubleshoot.
I figured Out it
I install Node Module Version 72 And reinstalled canvas by using the command npm i canvas
and it does not show error anymore
Thanks for your help
@shootdot I have installed Node Module Version 72 ( v12.18.4) and I got 8664 and my Node is x64 but I still have an issue as like you. how did u fix this issue?
Closing because there's not enough info to troubleshoot. Please open a new issue if anyone is still having problems.
فایل package.json تون باید به این صورت باشه { "name": "fuse-react-app", "version": "8.2.1", "private": true, "dependencies": { "@ckeditor/ckeditor5-build-classic": "^39.0.2", "@ckeditor/ckeditor5-react": "^6.1.0", "@ckeditor/ckeditor5-utils": "^39.0.2", "@date-io/date-fns-jalali": "^2.16.0", "@emotion/cache": "11.9.3", "@emotion/react": "11.9.3", "@emotion/styled": "11.9.3", "@hookform/resolvers": "2.9.7", "@mui/base": "5.0.0-alpha.93", "@mui/icons-material": "5.8.4", "@mui/lab": "^5.0.0-alpha.80", "@mui/material": "5.10.1", "@mui/styles": "5.9.3", "@mui/system": "5.10.1", "@mui/utils": "5.9.3", "@mui/x-data-grid": "5.15.2", "@mui/x-date-pickers": "5.0.0-beta.6", "@reduxjs/toolkit": "1.8.5", "@types/i18next": "^13.0.0", "@types/jest": "^29.5.2", "@types/node": "^20.4.1", "@types/platform": "^1.3.4", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.6", "autosuggest-highlight": "3.3.4", "axios": "0.27.2", "axios-mock-adapter": "1.21.2", "clsx": "1.2.1", "crypto-js": "^4.1.1", "date-fns": "2.29.1", "date-fns-jalali": "^2.30.0-0", "draft-js": "0.11.7", "draftjs-to-html": "0.9.1", "framer-motion": "7.2.0", "fuse-ckeditor5-custom-build": "0.0.1", "history": "5.3.0", "i18next": "^23.5.1", "i18next-browser-languagedetector": "^7.1.0", "i18next-http-backend": "^2.2.2", "jwt-decode": "3.1.2", "keycode": "2.2.1", "lodash": "4.17.21", "material-react-table": "^1.14.0", "mobile-detect": "1.4.5", "moment": "2.29.4", "notistack": "1.0.6-next.3", "num2persian": "^3.2.2", "perfect-scrollbar": "1.5.5", "platform": "^1.3.6", "prismjs": "1.28.0", "prop-types": "15.8.1", "qs": "6.11.0", "query-string": "^8.1.0", "react": "18.2.0", "react-autosuggest": "10.1.0", "react-dom": "18.2.0", "react-draft-wysiwyg": "1.15.0", "react-dropzone": "^14.2.3", "react-hook-form": "7.34.2", "react-i18next": "^13.2.2", "react-icons": "^4.10.1", "react-image-lightbox": "^5.1.4", "react-number-format": "^5.2.2", "react-pdf": "^7.3.3", "react-popper": "2.3.0", "react-redux": "8.0.2", "react-router-dom": "6.3.0", "react-swipeable": "7.0.0", "redux-logger": "4.0.0", "styled-components": "5.3.5", "stylis": "4.1.1", "stylis-plugin-rtl": "2.1.1", "web-vitals": "2.1.4", "yup": "0.32.11" }, "peerDependencies": { "autoprefixer": "10.4.7", "babel-jest": "^29.7.0", "postcss": "8.4.13", "react": "18.2.0", "react-dom": "18.2.0" }, "resolutions": { "react": "18.2.0", "react-dom": "18.2.0", "babel-loader": "8.1.0" }, "devDependencies": { "@babel/core": "7.17.10", "@babel/eslint-parser": "7.17.0", "@babel/node": "7.17.10", "@babel/preset-env": "7.17.10", "@babel/preset-react": "7.16.7", "@tailwindcss/aspect-ratio": "^0.4.0", "@tailwindcss/line-clamp": "^0.4.0", "@tailwindcss/typography": "^0.5.4", "@testing-library/jest-dom": "^6.1.3", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.5.1", "@types/crypto-js": "^4.1.1", "@types/webpack-env": "^1.18.1", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "autoprefixer": "9.8.8", "cross-env": "7.0.3", "eslint": "7.32.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.3.0", "eslint-config-react-app": "^6.0.0", "eslint-plugin-flowtype": "^5.10.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-react": "^7.26.1", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-unused-imports": "^1.1.5", "i18next-resources-for-ts": "^1.3.3", "immutable": "4.0.0", "postcss": "8.4.5", "prettier": "^2.4.1", "promise": "8.1.0", "react-app-alias": "2.2.0", "react-app-rewired": "2.2.1", "react-scripts": "5.0.1", "source-map-explorer": "2.5.2", "tailwindcss": "3.1.8", "typescript": "^4.6.4", "util": "^0.12.4" }, "scripts": { "start": "react-app-rewired start", "build": "echo use \"npm run build:production\" command for production mode and use \"npm run build:staging\" command for staging mode production build ", "build:production": "cross-env REACT_APP_RUNTIME_MODE=production GENERATE_SOURCEMAP=false react-app-rewired build", "build:staging": "cross-env REACT_APP_RUNTIME_MODE=staging react-app-rewired build", "serve": "serve -s build -l 8000", "test": "react-scripts test", "eject": "react-app-rewired eject", "build-docs": "babel-node --presets @babel/preset-env src/app/main/documentation/material-ui-components/build.js", "analyze": "react-app-rewired build && source-map-explorer 'build/static/js/*.js' --html analyze-result.html", "lint": "eslint" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "engines": { "node": ">=14.0.0", "npm": ">=7.0.0" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 3 safari version" ] }
}
Issue or Feature
Everytime when I install canvas I get the error canvas.node is not a valid Win32 application.