naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

Attempting build of React application, Error No: -4058 #57

Open jakeokony1024 opened 1 year ago

jakeokony1024 commented 1 year ago

I have a React application built using create-nw-react-app. I am seeing no warnings or errors in development mode, and everything is ready for a production build.

Every time I run "npm run build" I get the same error message:

Error: ENOENT: no such file or directory, scandir './cache/0.74.0-normal/win32/nwjs-normal-v0.74.0-win-ia32' at Object.readdirSync (node:fs:1390:3) at recursiveReaddirSync (C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\recursive-readdir-sync\index.js:7:18) at C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\nw-react-scripts\node_modules\nw-builder\lib\index.cjs:463:19 at C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\nw-react-scripts\node_modules\nw-builder\lib\index.cjs:949:12 at C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\lodash\lodash.js:4967:15 at baseForOwn (C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\lodash\lodash.js:3032:24) at C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\lodash\lodash.js:4936:18 at Function.forEach (C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\lodash\lodash.js:9410:14) at NwBuilder._forEachPlatform (C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\nw-react-scripts\node_modules\nw-builder\lib\index.cjs:948:5) at NwBuilder.copyNwjs (C:\Users\jokony.TEAMSCCI\another-mfim-test\node_modules\nw-react-scripts\node_modules\nw-builder\lib\index.cjs:456:8) { errno: -4058, syscall: 'scandir', code: 'ENOENT', path: './cache/0.74.0-normal/win32/nwjs-normal-v0.74.0-win-ia32' }

I have tried removing the node-modules, build and cache directories, ran npm-install again. and same error.

I have also created a test build to see if I get the same error. Steps to get error:

in cmd prompt: npx create-nw-react-app test-build cd test-build npm run build

Same error as above, with different file path. I did nothing to the source directory, removed nothing and installed no additional dependencies to the project, but cannot resolve this error.

Project is currently running node - v 16.13.0 Here is the package.json file:

{ "name": "test", "version": "0.1.0", "private": true, "dependencies": { "@bhyoon1110/react-chrome-tabs": "^1.1.1", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@mui/icons-material": "^5.11.11", "@mui/lab": "^5.0.0-alpha.123", "@mui/material": "^5.11.13", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", "cheerio": "^1.0.0-rc.12", "clsx": "^1.2.1", "flexsearch": "github:nextapps-de/flexsearch#0.7.0", "nw-react-scripts": "^4.0.4", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.9.0", "react-spring": "^9.7.1", "uuid": "^9.0.0", "web-vitals": "^1.1.2" }, "scripts": { "start": "nw-react-scripts start", "build": "nw-react-scripts build", "test": "nw-react-scripts test", "eject": "nw-react-scripts eject" }, "eslintConfig": { "extends": [ "nw-react-app", "nw-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" ] }, "main": "index.html", "height": "800px", "width": "1200px", "nwBuilder": { "//": "https://github.com/nwjs-community/nw-builder", "platforms": [ "osx64", "win32", "win64" ], "version": "latest", "flavor": "normal", "buildDir": "./build", "cacheDir": "./cache", "macIcns": "./src/logo.icns" }, "author": "", "license": "ISC" }

naviapis commented 1 year ago

@jakeokony1024 I just updated the library.

package.json

- "nw-react-scripts": "^4.0.4",
+ "nw-react-scripts": "^5.0.3",

npm install

jakeokony1024 commented 1 year ago

@naviapis Thanks for updating the library.

I tested the new package by creating a new react application, but got the same error message.

I uninstalled create-nw-react-app globally, per the instructions. I ran npx create-nw-react-app new-app once the application was built, I ran npm start, which compiled the project successfully.

I then attempted a build, ran npm run build, and am getting the same error as before.

The error is

Error: ENOENT: no such file or directory, scandir './cache/0.76.0-normal/win32/nwjs-normal-v0.76.0-win-ia32' at Object.readdirSync (node:fs:1390:3) at recursiveReaddirSync (C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\recursive-readdir-sync\index.js:7:18) at C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\nw-builder\lib\index.cjs:463:19 at C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\nw-builder\lib\index.cjs:949:12 at C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\lodash\lodash.js:4967:15 at baseForOwn (C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\lodash\lodash.js:3032:24) at C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\lodash\lodash.js:4936:18 at Function.forEach (C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\lodash\lodash.js:9410:14) at NwBuilder._forEachPlatform (C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\nw-builder\lib\index.cjs:948:5) at NwBuilder.copyNwjs (C:\Users\jokony.TEAMSCCI\mfim-app\node_modules\nw-builder\lib\index.cjs:456:8) { errno: -4058, syscall: 'scandir', code: 'ENOENT', path: './cache/0.76.0-normal/win32/nwjs-normal-v0.76.0-win-ia32' }

naviapis commented 1 year ago

@jakeokony1024 I couldn't confirm that. If you don't mind, please let me know your current Node.js and NPM versions. node -v npm -v


Although it is a temporary method, you may be able to solve it by changing the full path in package.json.

 {
   ...
   "nwBuilder": {
     ...
-    "buildDir": "./build",
-    "cacheDir": "./cache",
+    "buildDir": "C:\Users\jokony.TEAMSCCI\mfim-app\build",
+    "cacheDir": "C:\Users\jokony.TEAMSCCI\mfim-app\cache",
   },
 }
jakeokony1024 commented 1 year ago

Node version: v16.13.0 npm version: 9.6.6

I will try your temp method, thanks for the assistance!