我正在尝试将我的网站部署到 Netlify,但它不起作用。我是新手,所以感觉很混乱。站在代码文件夹中时,我运行了“npm run build”。 也从日志中尝试了这些步骤,但没有成功。在第 4 步之后,我认为遵循并难以理解该做什么会变得混乱。
11:34:35 PM: To fix the dependency tree, try following the steps below in the exact order:
11:34:35 PM: 1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
11:34:35 PM: 2. Delete node_modules in your project folder.
11:34:35 PM: 3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
11:34:35 PM: 4. Run npm install or yarn, depending on the package manager you use.
11:34:35 PM: In most cases, this should be enough to fix the problem.
11:34:35 PM: If this has not helped, there are a few other things you can try:
11:34:35 PM: 5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
11:34:35 PM: This may help because npm has known issues with package hoisting which may get resolved in future versions.
11:34:35 PM: 6. Check if /opt/build/repo/code/node_modules/babel-eslint is outside your project directory.
11:34:35 PM: For example, you might have accidentally installed something in your home folder.
11:34:35 PM: 7. Try running npm ls babel-eslint in your project folder.
11:34:35 PM: This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.
11:34:35 PM: If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
11:34:35 PM: That would permanently disable this preflight check in case you want to proceed anyway.
11:34:35 PM: P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
这是我的完整部署日志:
11:33:41 PM: Build ready to start
11:33:43 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
11:33:43 PM: build-image tag: v3.6.0
11:33:43 PM: buildbot version: 8ae026ef4905d9174e416775c6b64aa19950569b
11:33:43 PM: Fetching cached dependencies
11:33:43 PM: Failed to fetch cache, continuing with build
11:33:43 PM: Starting to prepare the repo for build
11:33:44 PM: No cached dependencies found. Cloning fresh repo
11:33:44 PM: git clone https://github.com/johannarexin/project-todos
11:33:44 PM: Preparing Git Reference refs/heads/master
11:33:46 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'code' versus '' in the Netlify UI
11:33:46 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'code/build' versus 'build/' in the Netlify UI
11:33:46 PM: Starting build script
11:33:46 PM: Installing dependencies
11:33:46 PM: Python version set to 2.7
11:33:47 PM: v12.18.0 is already installed.
11:33:48 PM: Now using node v12.18.0 (npm v6.14.4)
11:33:48 PM: Started restoring cached build plugins
11:33:48 PM: Finished restoring cached build plugins
11:33:48 PM: Attempting ruby version 2.7.1, read from environment
11:33:50 PM: Using ruby version 2.7.1
11:33:50 PM: Using PHP version 5.6
11:33:50 PM: Started restoring cached node modules
11:33:50 PM: Finished restoring cached node modules
11:33:51 PM: Installing NPM modules using NPM version 6.14.4
11:34:27 PM: > core-js@2.6.10 postinstall /opt/build/repo/code/node_modules/babel-runtime/node_modules/core-js
11:34:27 PM: > node postinstall || echo "ignore"
11:34:28 PM: > core-js@3.2.1 postinstall /opt/build/repo/code/node_modules/core-js
11:34:28 PM: > node scripts/postinstall || echo "ignore"
11:34:28 PM: > core-js-pure@3.8.1 postinstall /opt/build/repo/code/node_modules/core-js-pure
11:34:28 PM: > node -e "try{require('./postinstall')}catch(e){}"
11:34:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/watchpack/node_modules/fsevents):
11:34:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:34:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/jest-haste-map/node_modules/fsevents):
11:34:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:34:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/chokidar/node_modules/fsevents):
11:34:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:34:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/fsevents):
11:34:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:34:30 PM: added 1686 packages from 718 contributors and audited 1823 packages in 39.081s
11:34:32 PM: 32 packages are looking for funding
11:34:32 PM: run `npm fund` for details
11:34:32 PM: found 18574 vulnerabilities (18568 low, 1 moderate, 5 high)
11:34:32 PM: run `npm audit fix` to fix them, or `npm audit` for details
11:34:32 PM: NPM modules installed
11:34:32 PM: Started restoring cached go cache
11:34:32 PM: Finished restoring cached go cache
11:34:32 PM: go version go1.14.4 linux/amd64
11:34:32 PM: go version go1.14.4 linux/amd64
11:34:32 PM: Installing missing commands
11:34:32 PM: Verify run directory
11:34:34 PM:
11:34:34 PM: ────────────────────────────────────────────────────────────────
11:34:34 PM: Netlify Build
11:34:34 PM: ────────────────────────────────────────────────────────────────
11:34:34 PM:
11:34:34 PM: ❯ Version
11:34:34 PM: @netlify/build 8.0.0
11:34:34 PM:
11:34:34 PM: ❯ Flags
11:34:34 PM: deployId: 5fe27445e4c1ea2be29d926c
11:34:34 PM: mode: buildbot
11:34:34 PM:
11:34:34 PM: ❯ Current directory
11:34:34 PM: /opt/build/repo/code
11:34:34 PM:
11:34:34 PM: ❯ Config file
11:34:34 PM: /opt/build/repo/netlify.toml
11:34:34 PM:
11:34:34 PM: ❯ Context
11:34:34 PM: production
11:34:34 PM:
11:34:34 PM: ────────────────────────────────────────────────────────────────
11:34:34 PM: 1. build.command from netlify.toml
11:34:34 PM: ────────────────────────────────────────────────────────────────
11:34:34 PM:
11:34:34 PM: $ npm run build
11:34:35 PM: > technigo-react-starter@1.0.0 build /opt/build/repo/code
11:34:35 PM: > react-scripts build
11:34:35 PM:
11:34:35 PM: There might be a problem with the project dependency tree.
11:34:35 PM: It is likely not a bug in Create React App, but something you need to fix locally.
11:34:35 PM:
11:34:35 PM: The react-scripts package provided by Create React App requires a dependency:
11:34:35 PM: "babel-eslint": "10.0.3"
11:34:35 PM:
11:34:35 PM: Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-eslint was detected higher up in the tree:
11:34:35 PM: /opt/build/repo/code/node_modules/babel-eslint (version: 10.1.0)
11:34:35 PM: Manually installing incompatible versions is known to cause hard-to-debug issues.
11:34:35 PM: If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
11:34:35 PM: That will permanently disable this message but you might encounter other issues.
11:34:35 PM:
11:34:35 PM: To fix the dependency tree, try following the steps below in the exact order:
11:34:35 PM: 1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
11:34:35 PM: 2. Delete node_modules in your project folder.
11:34:35 PM: 3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
11:34:35 PM: 4. Run npm install or yarn, depending on the package manager you use.
11:34:35 PM: In most cases, this should be enough to fix the problem.
11:34:35 PM: If this has not helped, there are a few other things you can try:
11:34:35 PM: 5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
11:34:35 PM: This may help because npm has known issues with package hoisting which may get resolved in future versions.
11:34:35 PM: 6. Check if /opt/build/repo/code/node_modules/babel-eslint is outside your project directory.
11:34:35 PM: For example, you might have accidentally installed something in your home folder.
11:34:35 PM: 7. Try running npm ls babel-eslint in your project folder.
11:34:35 PM: This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.
11:34:35 PM: If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
11:34:35 PM: That would permanently disable this preflight check in case you want to proceed anyway.
11:34:35 PM: P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
11:34:35 PM:
11:34:35 PM: npm ERR! code ELIFECYCLE
11:34:35 PM: npm ERR! errno 1
11:34:35 PM: npm ERR! technigo-react-starter@1.0.0 build: `react-scripts build`
11:34:35 PM: npm ERR! Exit status 1
11:34:35 PM: npm ERR!
11:34:35 PM: npm ERR! Failed at the technigo-react-starter@1.0.0 build script.
11:34:35 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:34:35 PM: npm ERR! A complete log of this run can be found in:
11:34:35 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-12-22T22_34_35_418Z-debug.log
11:34:35 PM:
11:34:35 PM: ────────────────────────────────────────────────────────────────
11:34:35 PM: "build.command" failed
11:34:35 PM: ────────────────────────────────────────────────────────────────
11:34:35 PM:
11:34:35 PM: Error message
11:34:35 PM: Command failed with exit code 1: npm run build
11:34:35 PM:
11:34:35 PM: Error location
11:34:35 PM: In build.command from netlify.toml:
11:34:35 PM: npm run build
11:34:35 PM:
11:34:35 PM: Resolved config
11:34:35 PM: build:
11:34:35 PM: base: /opt/build/repo/code
11:34:35 PM: command: npm run build
11:34:35 PM: commandOrigin: config
11:34:35 PM: publish: /opt/build/repo/code/build
11:34:35 PM: Caching artifacts
11:34:35 PM: Started saving node modules
11:34:35 PM: Finished saving node modules
11:34:35 PM: Started saving build plugins
11:34:35 PM: Finished saving build plugins
11:34:35 PM: Started saving pip cache
11:34:35 PM: Finished saving pip cache
11:34:35 PM: Started saving emacs cask dependencies
11:34:35 PM: Finished saving emacs cask dependencies
11:34:35 PM: Started saving maven dependencies
11:34:35 PM: Finished saving maven dependencies
11:34:35 PM: Started saving boot dependencies
11:34:35 PM: Finished saving boot dependencies
11:34:35 PM: Started saving rust rustup cache
11:34:35 PM: Finished saving rust rustup cache
11:34:35 PM: Started saving rust cargo bin cache
11:34:35 PM: Finished saving rust cargo bin cache
11:34:35 PM: Started saving go dependencies
11:34:35 PM: Finished saving go dependencies
11:34:38 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:34:38 PM: Failing build: Failed to build site
11:34:38 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:34:38 PM: Finished processing build request in 55.491634064s