我似乎无法更新生产服务器上的部署。构建错误日志说我有很多我不认识的随机包的npm ERR! Missing
。
任何想法吗?
npm run dev
在本地工作正常。
npm run build
在本地也有效。
package.json:
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@sendgrid/mail": "^7.6.0",
"axios": "^0.22.0",
"is-hotkey": "^0.1.8",
"jsonwebtoken": "^8.5.1",
"lodash.debounce": "^4.0.8",
"next": "^12.0.7",
"next-auth": "^4.0.0-beta.6",
"next-share": "^0.12.2",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "^1.42.1",
"slate": "^0.66.5",
"slate-history": "^0.66.0",
"slate-hyperscript": "^0.67.0",
"slate-react": "^0.66.7",
"swr": "^1.2.2",
"zustand": "^3.5.13"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-next": "11.1.2",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1"
},
"peerDependencies": {
"postcss": "^8.2.15"
}
}
被截断的构建日志:(完整的构建日志太长,不能在这里发布,但可以在https://pastebin.com/X3QsT5Ub上找到)
2023-01-03T05:23:32.941474763Z [34m╭────────────[34m[30m[44m git repo clone [0m[0m[34m───────────╼[0m
2023-01-03T05:23:32.941522581Z [34m│[0m [34m › fetching app source code[0m
2023-01-03T05:23:32.941527248Z [34m│[0m => Selecting branch "main"
2023-01-03T05:23:33.592330065Z [34m│[0m => Checking out commit "2aad59cbc2d09d76318d8aed38923d1343d3e687"
2023-01-03T05:23:33.639870414Z [34m│[0m
2023-01-03T05:23:33.642769027Z [34m│[0m [32m ✔ cloned repo to [35m/workspace[0m[0m
2023-01-03T05:23:33.668461263Z [34m╰────────────────────────────────────────╼[0m
2023-01-03T05:23:33.668489897Z
2023-01-03T05:23:33.813826428Z [34m › configuring build-time app environment variables:[0m
2023-01-03T05:23:33.813853591Z SENDGRID_REQUEST_API_KEY NEXTAUTH_URL JWT_SECRET TWITTER_CLIENT_ID SESSION_SECRET FACEBOOK_CLIENT_SECRET NEXT_PUBLIC_API_URL GOOGLE_CLIENT_ID NEXT_PUBLIC_GOOGLE_ANALYTICS SENDGRID_API_KEY TWITTER_CLIENT_SECRET GOOGLE_CLIENT_SECRET FACEBOOK_CLIENT_ID NEXT_PUBLIC_CDN_URL NEXT_PUBLIC_URL
2023-01-03T05:23:33.813858557Z
2023-01-03T05:23:33.816914126Z [34m › configuring custom build command to be run at the end of the build:[0m
2023-01-03T05:23:33.824312558Z [34m│[0m npm run build
2023-01-03T05:23:33.824325409Z
2023-01-03T05:23:33.939270524Z [34m╭────────────[34m[30m[44m buildpack detection [0m[0m[34m───────────╼[0m
2023-01-03T05:23:33.957886779Z [34m│[0m [34m › using Ubuntu 18.04 stack[0m
2023-01-03T05:23:34.335160381Z [34m│[0m Detected the following buildpacks suitable to build your app:
2023-01-03T05:23:34.335187887Z [34m│[0m
2023-01-03T05:23:34.335192227Z [34m│[0m heroku/nodejs-engine v0.5.1
2023-01-03T05:23:34.335195933Z [34m│[0m digitalocean/node v0.3.4 (Node.js)
2023-01-03T05:23:34.335198998Z [34m│[0m digitalocean/procfile v0.0.3 (Procfile)
2023-01-03T05:23:34.335201882Z [34m│[0m digitalocean/custom v0.1.1 (Custom Build Command)
2023-01-03T05:23:34.335204790Z [34m│[0m
2023-01-03T05:23:34.335208439Z [34m│[0m For documentation on the buildpacks used to build your app, please see:
2023-01-03T05:23:34.335211277Z [34m│[0m
2023-01-03T05:23:34.335214285Z [34m│[0m Node.js v0.3.4 https://do.co/apps-buildpack-node
2023-01-03T05:23:34.338731564Z [34m╰─────────────────────────────────────────────╼[0m
2023-01-03T05:23:34.338756219Z
2023-01-03T05:23:34.342499466Z [34m╭────────────[34m[30m[44m build caching [0m[0m[34m───────────╼[0m
2023-01-03T05:23:34.345203660Z [34m│[0m [34m › checking for cache from a previous build[0m
2023-01-03T05:23:36.349910107Z [34m│[0m Layer cache not found
2023-01-03T05:23:36.840439508Z [34m│[0m Restoring metadata for "heroku/nodejs-engine:nodejs" from app image
2023-01-03T05:23:38.022936715Z [34m│[0m Layer cache not found
2023-01-03T05:23:38.206441335Z [34m│[0m Removing "heroku/nodejs-engine:nodejs", not in cache
2023-01-03T05:23:38.228319066Z [34m╰───────────────────────────────────────╼[0m
2023-01-03T05:23:38.228345695Z
2023-01-03T05:23:38.231939436Z [34m╭────────────[34m[30m[44m app build [0m[0m[34m───────────╼[0m
2023-01-03T05:23:38.270899451Z [34m│[0m ---> Node.js Buildpack
2023-01-03T05:23:38.271778947Z [34m│[0m ---> Installing toolbox
2023-01-03T05:23:38.272990789Z [34m│[0m ---> - jq
2023-01-03T05:23:38.767230760Z [34m│[0m ---> - yj
2023-01-03T05:23:40.421610852Z [34m│[0m ---> Getting Node version
2023-01-03T05:23:40.426719023Z [34m│[0m ---> Resolving Node version
2023-01-03T05:23:41.576349974Z [34m│[0m ---> Downloading and extracting Node v16.19.0
2023-01-03T05:23:44.133555936Z [34m│[0m ---> Parsing package.json
2023-01-03T05:23:44.682951726Z [34m│[0m ---> No file to start server
2023-01-03T05:23:44.682986333Z [34m│[0m ---> either use 'docker run' to start container or add index.js or server.js
2023-01-03T05:23:44.705125940Z [34m│[0m Project contains package-lock.json, using npm
2023-01-03T05:23:45.186038000Z [34m│[0m Using npm v8.19.3. To configure a different version of npm, set the engines.npm property in package.json.
2023-01-03T05:23:45.186070065Z [34m│[0m See https://do.co/apps-buildpack-node for further instructions.
2023-01-03T05:23:45.186073642Z [34m│[0m Installing node_modules using npm (from package-lock.json)
2023-01-03T05:23:45.558705466Z [34m│[0m Running npm ci
2023-01-03T05:23:45.558734033Z [34m│[0m
2023-01-03T05:24:35.546488253Z [34m│[0m npm notice
2023-01-03T05:24:35.546897593Z [34m│[0m npm notice New major version of npm available! 8.19.3 -> 9.2.0
2023-01-03T05:24:35.546924246Z [34m│[0m npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
2023-01-03T05:24:35.546928926Z [34m│[0m npm notice Run `npm install -g npm@9.2.0` to update!
2023-01-03T05:24:35.546933358Z [34m│[0m npm notice
2023-01-03T05:24:35.745769724Z [34m│[0m npm ERR! code EUSAGE
2023-01-03T05:24:36.132947911Z [34m│[0m npm ERR!
2023-01-03T05:24:36.132995675Z [34m│[0m npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
2023-01-03T05:24:36.133000833Z [34m│[0m npm ERR!
2023-01-03T05:24:36.133005170Z [34m│[0m npm ERR! Missing: react-scripts@4.0.3 from lock file
2023-01-03T05:24:36.133009345Z [34m│[0m npm ERR! Missing: @pmmmwh/react-refresh-webpack-plugin@0.4.3 from lock file
2023-01-03T05:24:36.133012622Z [34m│[0m npm ERR! Missing: react-refresh@0.8.3 from lock file
2023-01-03T05:24:36.133016415Z [34m│[0m npm ERR! Missing: webpack@4.44.2 from lock file
2023-01-03T05:24:36.133164448Z [34m│[0m npm ERR! Missing: type-fest@0.13.1 from lock file
2023-01-03T05:24:36.133195451Z [34m│[0m npm ERR! Missing: @svgr/webpack@5.5.0 from lock file
2023-01-03T05:24:36.217638704Z [34m│[0m npm ERR! Missing: rimraf@2.7.1 from lock file
2023-01-03T05:24:36.217643475Z [34m│[0m npm ERR! Missing: run-queue@1.0.3 from lock file
2023-01-03T05:24:36.217648027Z [34m│[0m npm ERR! Missing: iferr@0.1.5 from lock file
2023-01-03T05:24:36.217806649Z [34m│[0m npm ERR! Missing: rimraf@2.7.1 from lock file
2023-01-03T05:24:36.217823920Z [34m│[0m npm ERR! Missing: cyclist@1.0.1 from lock file
2023-01-03T05:24:36.217829162Z [34m│[0m npm ERR! Missing: pump@2.0.1 from lock file
2023-01-03T05:24:36.217833834Z [34m│[0m npm ERR! Missing: yallist@3.1.1 from lock file
2023-01-03T05:24:36.217837368Z [34m│[0m npm ERR! Missing: jsonfile@4.0.0 from lock file
2023-01-03T05:24:36.217841611Z [34m│[0m npm ERR! Missing: universalify@0.1.2 from lock file
2023-01-03T05:24:36.218012211Z [34m│[0m npm ERR! Missing: locate-path@5.0.0 from lock file
2023-01-03T05:24:36.218018480Z [34m│[0m npm ERR! Missing: path-exists@4.0.0 from lock file
2023-01-03T05:24:36.218023290Z [34m│[0m npm ERR! Missing: p-locate@4.1.0 from lock file
2023-01-03T05:24:36.218028050Z [34m│[0m npm ERR! Missing: p-limit@2.3.0 from lock file
2023-01-03T05:24:36.218032719Z [34m│[0m npm ERR! Missing: is-extendable@0.1.1 from lock file
2023-01-03T05:24:36.218037369Z [34m│[0m npm ERR! Missing: is-extendable@0.1.1 from lock file
2023-01-03T05:24:36.218042215Z [34m│[0m npm ERR! Missing: is-extendable@0.1.1 from lock file
2023-01-03T05:24:36.218212401Z [34m│[0m npm ERR! Missing: is-extendable@0.1.1 from lock file
2023-01-03T05:24:36.218226689Z [34m│[0m npm ERR! Missing: is-extendable@0.1.1 from lock file
2023-01-03T05:24:36.218245350Z [34m│[0m npm ERR! Missing: ansi-regex@4.1.1 from lock file
2023-01-03T05:24:36.218250343Z [34m│[0m npm ERR! Missing: ansi-regex@4.1.1 from lock file
2023-01-03T05:24:36.218385681Z [34m│[0m npm ERR! Missing: ansi-regex@4.1.1 from lock file
2023-01-03T05:24:36.218396179Z [34m│[0m npm ERR! Missing: is-extendable@0.1.1 from lock file
2023-01-03T05:24:36.218401143Z [34m│[0m npm ERR!
2023-01-03T05:24:36.218406825Z [34m│[0m npm ERR! Clean install a project
2023-01-03T05:24:36.218411320Z [34m│[0m npm ERR!
2023-01-03T05:24:36.218416947Z [34m│[0m npm ERR! Usage:
2023-01-03T05:24:36.218421023Z [34m│[0m npm ERR! npm ci
2023-01-03T05:24:36.218425306Z [34m│[0m npm ERR!
2023-01-03T05:24:36.218429863Z [34m│[0m npm ERR! Options:
2023-01-03T05:24:36.218512838Z [34m│[0m npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
2023-01-03T05:24:36.218524674Z [34m│[0m npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
2023-01-03T05:24:36.218530426Z [34m│[0m npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
2023-01-03T05:24:36.218534991Z [34m│[0m npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
2023-01-03T05:24:36.218540317Z [34m│[0m npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
2023-01-03T05:24:36.218729253Z [34m│[0m npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
2023-01-03T05:24:36.218736626Z [34m│[0m npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
2023-01-03T05:24:36.218740402Z [34m│[0m npm ERR!
2023-01-03T05:24:36.218744170Z [34m│[0m npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
2023-01-03T05:24:36.218747870Z [34m│[0m npm ERR!
2023-01-03T05:24:36.218751678Z [34m│[0m npm ERR! Run "npm help ci" for more info
2023-01-03T05:24:36.224982603Z [34m│[0m
2023-01-03T05:24:36.225313808Z [34m│[0m npm ERR! A complete log of this run can be found in:
2023-01-03T05:24:36.225422736Z [34m│[0m npm ERR! /home/apps/.npm/_logs/2023-01-03T05_23_45_874Z-debug-0.log
2023-01-03T05:24:36.254075934Z [34m│[0m
2023-01-03T05:24:36.254115394Z [34m│[0m unable to invoke layer creator
2023-01-03T05:24:36.254122169Z [34m│[0m installing node_modules: exit status 1
2023-01-03T05:24:36.254968098Z [34m│[0m [31;1mERROR: [0mfailed to build: exit status 1
2023-01-03T05:24:36.408187117Z [34m│[0m
2023-01-03T05:24:36.411589784Z [34m│[0m
2023-01-03T05:24:36.411615123Z [34m│[0m For documentation on the buildpacks used to build your app, please see:
2023-01-03T05:24:36.411620053Z [34m│[0m
2023-01-03T05:24:36.411623774Z [34m│[0m Node.js v0.3.4 https://do.co/apps-buildpack-node
2023-01-03T05:24:36.412603777Z [34m│[0m
2023-01-03T05:24:36.424794044Z [34m│[0m [31m ✘ build failed[0m
修复…
- 将我的节点和npm环境设置为本地和生产环境相同
- 这导致了一个新的错误和帮助页面:https://nextjs.org/docs/messages/failed-loading-swc