help please I keep on getting this error and I don't know what's wrong first I use the npm run build then it gave me the same error then I watch YouTube and change it to CI= npm build but this error is still showing up, how can I fix this?
got exactly the same error for many times. And tried the same things. If anyone can help I guess we all appreciate it.
Below you can find my package.json file
{
"name": "cryptocheck24",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#heroicons/react": "^2.0.10",
"#portabletext/react": "^1.0.6",
"#sanity/client": "^3.3.6",
"#sanity/image-url": "^1.0.1",
"flowbite": "^1.5.3",
"flowbite-react": "^0.1.11",
"groq": "^2.29.3",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"tippy.js": "^6.3.7"
},
"devDependencies": {
"autoprefixer": "^10.4.8",
"eslint": "8.23.0",
"eslint-config-next": "12.2.5",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8"
}
}
Related
Faced this issue when I was using login functionality developed by my teammate in a group project and apparently I am the only one facing this issue.
npm version: 8.19.3
node version: 16.17.0
package.json :-
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "npm run prettify && next dev",
"build": "npm run prettify && next build",
"start": "next start",
"lint": "npm run prettify && next lint",
"prettify": "prettier --write \"**/*.{js, jsx}\""
},
"dependencies": {
"#emotion/react": "11.10.4",
"#emotion/server": "11.10.0",
"#emotion/styled": "11.10.4",
"#mui/icons-material": "5.10.6",
"#mui/material": "5.10.6",
"#mui/x-date-pickers": "^5.0.3",
"cryptr": "^6.0.3",
"dayjs": "^1.11.5",
"intl": "^1.2.5",
"mui-file-dropzone": "^4.0.2",
"next": "12.2.5",
"next-auth": "^4.12.0",
"normalize.css": "^8.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-share": "^4.4.1",
"react-toastify": "^9.0.8",
"swr": "^1.3.0",
"universal-cookie": "^4.0.4"
},
"devDependencies": {
"eslint": "8.23.1",
"eslint-config-next": "12.3.1",
"eslint-config-prettier": "8.5.0",
"prettier": "2.7.1"
}
}
Error :-
error - Error: Cannot find module 'next/headers'
I have tried deleting the node_modules and .next folders but I am still facing this issue.
That is when you update Nextjs to version 13 with next-auth, which is intended for next#13 users, in your case using version 12 yet, the root cause the error in v4.12.x with next/headers package from next#12, so it could be to support getting the session in React Server Components for example.
Edit package.json, it should fix your issue:
{
"next-auth": "4.15.1"
}
I've been trying to execute a react native application using npm start. The application used to work but since I've made a pull from GitHub it stopped working, giving me a JSON Error in C:\...\package.json: "dep...'ADoken < in JSON at position 3 while parsing near '{. I've tried all the methods I could find in here, including cleaning the cache, reinstalling all libraries, doing a npm install, reinstalling angular-cli, updating expo-cli and npm, deleting package-lock.json and doing a npm set registry https://registry.npmjs.org/. I've been stuck at this for 3 hours at least, I don't know what to do...
Here's my package.json file:
{
"name": "Name",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#firebase/firestore": "^3.4.5",
"#material-ui/core": "^4.12.3",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/native": "^6.0.8",
"#react-navigation/native-stack": "^6.5.0",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"firebase": "^9.6.7",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-dropdown-picker": "^5.3.0",
"react-native-icons": "^0.7.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-vector-icons": "^9.1.0",
"react-native-web": "0.17.1"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
I have a nodejs typescript project with this package.json:
{
"name": "construction-node-service",
"version": "1.0.0",
"description": "Fine Chat App Nodejs Service",
"main": "app.js",
"types": "./#types",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"debug": "nodemon --inspect src/app.ts",
"dev:debug": "nodemon --config nodemon.json --inspect-brk src/index.ts",
"tsdebug": "ts-node-dev --respawn ",
"tsdev": "nodemon --exec ts-node tt.ts",
"compile": "tsc && node dist/app.js",
"dev": "nodemon -e ts --exec npm run compile",
"dev:server": "nodemon --watch ./**/*.ts --exec ts-node src/app.ts",
"start": "node dist/app.js"
},
"engines": {
"node": "12.22.1"
},
"author": "Ayman Shokry",
"license": "ISC",
"dependencies": {
"#types/compression": "^1.7.0",
"bson-objectid": "^2.0.1",
"compression": "^1.7.4",
"express": "^4.17.1",
"generate-unique-id": "^2.0.1",
"global-shared-node": "file:../../../public-api/NodeJs/global-shared-node",
"public-dao-node": "file:../../../public-api/NodeJs/public-dao-node",
"helmet": "^4.6.0",
"moment": "^2.29.1",
"mongoose": "^5.12.1",
"multer": "^1.4.2",
"mysql2": "^2.1.0",
"reflect-metadata": "^0.1.13",
"sequelize": "^6.6.2",
"sequelize-typescript": "^2.1.0",
"socket.io": "^2.3.0"
},
"devDependencies": {
"#types/express": "^4.17.11",
"#types/node": "^15.0.1",
"#types/sequelize": "^4.28.9",
"#types/validator": "^13.1.3",
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"pm2": "^4.5.0",
"rimraf": "^3.0.2",
"sequelize-cli": "^5.5.1",
"ts-node": "^9.1.1",
"ts-node-dev": "^1.1.6",
"typescript": "^4.2.4"
}
}
I thought if I can copy the 2 local project src files to my project src folder before deploy but I think this solution is annoying
as you see I referenced 2 local projects on my HDD the question is how can I deploy this project with the 2 project dependencies to Heroku.thanks
As per the questions and suggestions on the internet, the answer is NO.
According to many communities and experts, Heroku's model is to run one app per dyno (and often many dynos for a single app).
But wait, there is a case in which two servers are deployed to a single dyno and it worked too. You can check it here: https://medium.com/#nadayar/heroku-fu-multiple-servers-on-one-dyno-6fc68d57b373
Hope this solves your problem!
I receive the following error message after deploying my Next.js app on Google Cloud's AppEngine. Before deploying the app I run npm run-scrip build locally. Starting the app locally does work fine as well.
While deploying glcoud app deploy I do not receive any error. After opening the app gcloud app browse I receive server response [500].
In the log I find following error:
Error: Could not find a valid build in the '/workspace/.next' directory! Try building your app with 'next build' before starting the server.
at Server.readBuildId (/workspace/node_modules/next/dist/next-server/server/next-server.js:137)
at Server (/workspace/node_modules/next/dist/next-server/server/next-server.js:3)
at createServer (/workspace/node_modules/next/dist/server/next.js:2)
at start (/workspace/node_modules/next/dist/server/lib/start-server.js:1)
at nextStart (/workspace/node_modules/next/dist/cli/next-start.js:19)
at (/workspace/node_modules/next/dist/bin/next:26)
This is my package.json:
{
"name": "next-project",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p 8080",
"preinstall": "node lock_node_version.js"
}
app.yaml file:
env: standard
runtime: nodejs14
service: default
handlers:
- url: /.*
secure: always
script: auto
EDIT/ADDED
"dependencies": {
"#apollo/client": "^3.3.6",
"#apollo/react-hooks": "^4.0.0",
"#date-io/date-fns": "^1.3.13",
"#material-ui/core": "^4.11.2",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.57",
"#material-ui/pickers": "^3.2.10",
"apollo-server-micro": "^2.19.0",
"check-node-version": "^4.1.0",
"date-fns": "^2.16.1",
"firebase": "^8.2.2",
"firebase-admin": "^9.4.2",
"js-cookie": "^2.2.1",
"lowdb": "^1.0.0",
"next": "10.0.3",
"next-i18next": "^7.0.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-material-ui-carousel": "^2.1.1"
}
,
"devDependencies": {
"#types/lowdb": "^1.0.9",
"#types/node": "^14.14.10",
"#typescript-eslint/eslint-plugin": "^4.9.0",
"#typescript-eslint/parser": "^4.9.0",
"eslint": "^7.14.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"typescript": "^4.1.2"
},
Any help much appreciated!
You can have the same identical behavior of build script to build your app before deployment in App Engine by using gcp-build. It is well documented on GCP docs and here's an example for you:
"scripts": {
"dev": "next dev",
"gcp-build": "next build",
"start": "next start -p 8080",
"preinstall": "node lock_node_version.js"
}
To address the confusion in the comments, you may have noticed that in the docs, the command tsc -p . specified as a custom build step. What it does is it compiles Typescript code because the example itself is a Typescript app. You don't need to run it unless you're using Typescript. It's always up to you and you're free to specify any commands when using gcp-build.
We are using Microsoft Windows for both development and hosting.
npm version - 6.8.0
node version - 10.15.3
I would like to know how I can start my ReactApp locally on my development machine as in Production environment.
We have multiple environments at work such as Test, Staging, PreProd, Prod.... etc and we want to test the behaviour of the app without actual deployment to the target env.
We've got some logic statements in the source codes by using process.env.NODE_ENV to check the different environments.
I tried to update package.json scripts section as the following. But, it doesn't work.
"scripts": {
"start": "react-scripts start",
"start-prod": "cross-env NODE_ENV=production react-scripts start",
"start-prod2": "set NODE_ENV=production&&react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
I tried both start-prod and start-prod2 . Even though it hosts the app successfully, it's always in development mode. Please see the following screenshots:
npm run start-prod
npm run start-prod2
If I use npm run build, it generates the build with production env. But it takes too much time to test.
Could you please guide me how I could simulate the various environment in my development machine?
P.S. I'm just using the default create-react-app script set up and I don't have any custom webpack config file.
Complete package.json file
{
"name": "react-workout-diary",
"version": "0.10.0",
"private": true,
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.18",
"#fortawesome/free-brands-svg-icons": "^5.8.2",
"#fortawesome/free-regular-svg-icons": "^5.8.2",
"#fortawesome/free-solid-svg-icons": "^5.8.2",
"#fortawesome/react-fontawesome": "^0.1.4",
"axios": "^0.19.0",
"bootstrap": "^4.3.1",
"es6-object-assign": "^1.1.0",
"es6-promise": "^4.2.6",
"formik": "^1.5.7",
"has-value": "^2.0.2",
"is-empty": "^1.2.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-datepicker": "^2.6.0",
"react-delay": "^0.1.0",
"react-dom": "^16.8.6",
"react-moment": "^0.9.2",
"react-redux": "^7.0.3",
"react-router-dom": "^5.0.0",
"react-scripts": "^3.0.1",
"react-toastify": "^5.2.1",
"reactstrap": "^8.0.0",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-saga": "^1.0.2",
"redux-saga-routines": "^3.1.3",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"uuid": "^3.3.2",
"yup": "^0.27.0"
},
"scripts": {
"start": "react-scripts start",
"start-prod": "cross-env NODE_ENV=production react-scripts start",
"start-prod2": "set NODE_ENV=production&&react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"cross-env": "^5.2.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.13.2",
"enzyme-to-json": "^3.3.5",
"react-test-renderer": "^16.8.6",
"redux-saga-test-plan": "^4.0.0-beta.3"
}
}
You can't change the NODE_ENV variable:
You cannot override NODE_ENV manually. This prevents developers from
accidentally deploying a slow development build to production.
What you can do is to use different .env files:
From: React documentation
Files on the left have more priority than files on the right:
npm start: .env.development.local, .env.development, .env.local, .env
npm run build: .env.production.local, .env.production, .env.local, .env
npm test: .env.test.local, .env.test, .env (note .env.local is missing)