Blockquote
I am a front-end development engineer and encountered a mistake while taking over my colleague’s project.
This project should have been created using the React static framework, and I know the required node version for building is 10.16.0, because this is the version for the online environment。
enter image description here
After running npm install in the root directory of the project to download the dependencies, I tried to use npm run react static build to build the project, but failed.
The error message is as follows:
Trace: { code: 'MODULE_NOT_FOUND' }
at init.catch.e (D:projects20240718websitefront_pronode_modulesreact-staticbinreact-static:6:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: Cannot find module 'D:projects20240718websitefront_proartifactsstatic-app.js'
This is my packaging.json file
{
"name": "project",
"private": true,
"scripts": {
"start": "react-static start",
"stage": "react-static build --staging",
"build": "run-s build:*",
"build:static": "react-static build",
"build:delete": "mv dist versions/$(date '+%d%m%Y-%H%M%S')",
"build:move": "mv disting dist",
"bundle": "react-static bundle",
"export": "react-static export",
"serve": "serve dist -p 3000 -s"
},
"browserslist": [
"> 0.1%",
"last 4 versions",
"Firefox ESR",
"not ie < 11",
"ie 11"
],
"dependencies": {
"@babel/runtime": "^7.4.2",
"@reach/router": "^1.2.1",
"@researchgate/react-intersection-observer": "^0.7.4",
"add": "^2.0.6",
"axios": "^0.18.0",
"babel-polyfill": "^7.0.0-beta.3",
"babel-runtime": "^6.26.0",
"browserlist": "^1.0.1",
"dotenv": "^8.0.0",
"es6-promise": "^4.2.8",
"eslint-config-standard-react": "^7.0.2",
"font-face-observer": "^1.0.0",
"google-map-react": "^1.1.4",
"gsap": "^2.1.2",
"js-cookie": "^2.2.0",
"jshint": "^2.10.2",
"lodash": "^4.17.11",
"qrcode": "^1.4.1",
"qs": "^6.7.0",
"react": "^16.11.0",
"react-app-polyfill": "^1.0.1",
"react-baidu-maps": "^1.0.8",
"react-bmap": "^1.0.100",
"react-dom": "^16.8.2",
"react-flickity-component": "^3.4.0",
"react-google-recaptcha": "^1.0.5",
"react-leaflet": "^2.4.0",
"react-static": "^7.2.3",
"react-static-plugin-reach-router": "^7.2.2",
"react-static-plugin-sitemap": "^7.2.2",
"react-static-plugin-source-filesystem": "^7.2.2",
"react-youtube": "^7.9.0",
"sass-resources-loader": "^2.0.0",
"sha1-hex": "^1.0.0",
"stickyfilljs": "^2.1.0"
},
"devDependencies": {
"autoprefixer": "^9.5.1",
"babel-eslint": "9.x",
"dayjs": "^1.8.14",
"eslint": "5.x",
"eslint-config-prettier": "^4.1.0",
"eslint-config-react-app": "^3.0.8",
"eslint-config-react-tools": "1.x.x",
"eslint-plugin-flowtype": "2.x",
"eslint-plugin-import": "2.x",
"eslint-plugin-jsx-a11y": "6.x",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "7.x",
"extract-css-chunks-webpack-plugin": "^4.3.2",
"node-sass": "^4.12.0",
"npm-run-all": "^4.1.5",
"postcss-flexbugs-fixes": "^4.1.0",
"sass-loader": "^7.1.0",
"semver": "^6.0.0",
"serve": "10.1.2"
}
}
I created a new React static project and found that whenever I build the project, static-app.js is automatically generated in the artifacts file at the root directory of the project
and my new project:
enter image description here
old project:
enter image description here
王雪迪 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.