主页

在运行yarn start时报错

2024-03-12 11:41AM

在运行 yarn start 时报错:

meiyi@meiyi-Extensa-2511G:~/workspace/react-blog-main$ yarn start
yarn run v1.22.19
$ cross-env NODE_ENV=development webpack-dev-server --config ./scripts/config/webpack.dev.js
/bin/sh: 1: cross-env: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

解决方法:

使用 yarn install 命令

meiyi@meiyi-Extensa-2511G:~/workspace/react-blog-main$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @ahooksjs/use-url-state@3.1.13" has unmet peer dependency "react-router@^5.0.0 || ^6.0.0".
warning " > postcss-loader@6.2.1" has unmet peer dependency "postcss@^7.0.0 || ^8.0.1".
warning " > postcss-preset-env@7.4.1" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > @csstools/postcss-color-function@1.0.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > @csstools/postcss-font-format-keywords@1.0.0" has unmet peer dependency "postcss@^8.3".
warning "postcss-preset-env > @csstools/postcss-hwb-function@1.0.0" has unmet peer dependency "postcss@^8.3".
warning "postcss-preset-env > @csstools/postcss-ic-unit@1.0.0" has unmet peer dependency "postcss@^8.3".
warning "postcss-preset-env > @csstools/postcss-is-pseudo-class@2.0.1" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > @csstools/postcss-normalize-display-values@1.0.0" has unmet peer dependency "postcss@^8.3".
warning "postcss-preset-env > @csstools/postcss-oklab-function@1.0.2" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > @csstools/postcss-progressive-custom-properties@1.3.0" has unmet peer dependency "postcss@^8.3".
warning "postcss-preset-env > autoprefixer@10.4.2" has unmet peer dependency "postcss@^8.1.0".
warning "postcss-preset-env > css-blank-pseudo@3.0.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > css-has-pseudo@3.0.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > css-prefers-color-scheme@6.0.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-attribute-case-insensitive@5.0.0" has unmet peer dependency "postcss@^8.0.2".
warning "postcss-preset-env > postcss-clamp@4.0.0" has unmet peer dependency "postcss@^8.4.6".
warning "postcss-preset-env > postcss-color-functional-notation@4.2.2" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-color-hex-alpha@8.0.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-color-rebeccapurple@7.0.2" has unmet peer dependency "postcss@^8.3".
warning "postcss-preset-env > postcss-custom-media@8.0.0" has unmet peer dependency "postcss@^8.1.0".
warning "postcss-preset-env > postcss-custom-properties@12.1.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-custom-selectors@6.0.0" has unmet peer dependency "postcss@^8.1.2".
warning "postcss-preset-env > postcss-dir-pseudo-class@6.0.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-double-position-gradients@3.1.1" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-env-function@4.0.5" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-focus-visible@6.0.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-focus-within@5.0.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-font-variant@5.0.0" has unmet peer dependency "postcss@^8.1.0".
warning "postcss-preset-env > postcss-gap-properties@3.0.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-image-set-function@4.0.6" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-initial@4.0.1" has unmet peer dependency "postcss@^8.0.0".
warning "postcss-preset-env > postcss-lab-function@4.1.2" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-logical@5.0.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-media-minmax@5.0.0" has unmet peer dependency "postcss@^8.1.0".
warning "postcss-preset-env > postcss-nesting@10.1.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-overflow-shorthand@3.0.3" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-page-break@3.0.4" has unmet peer dependency "postcss@^8".
warning "postcss-preset-env > postcss-place@7.0.4" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-pseudo-class-any-link@7.1.1" has unmet peer dependency "postcss@^8.4".
warning "postcss-preset-env > postcss-replace-overflow-wrap@4.0.0" has unmet peer dependency "postcss@^8.0.3".
warning "postcss-preset-env > postcss-selector-not@5.0.0" has unmet peer dependency "postcss@^8.1.0".
[4/4] Building fresh packages...
Done in 374.08s.

然后重新运行 yarn start 命令,就可以了。

meiyi@meiyi-Extensa-2511G:~/workspace/react-blog-main$ yarn start
yarn run v1.22.19
$ cross-env NODE_ENV=development webpack-dev-server --config ./scripts/config/webpack.dev.js

✔ Webpack
  Compiled successfully in 29.47s

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/, http://127.0.0.1:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/home/meiyi/workspace/react-blog-main/public' directory
<i> [webpack-dev-server] 404s will fallback to '/index.html'
<i> [webpack-dev-middleware] wait until bundle finished: /
Browserslist: caniuse-lite is outdated. Please run:

npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating 

返回>>

登录

请登录后再发表评论。

评论列表:

目前还没有人发表评论