Mat*_*gen 3 npm reactjs oh-my-zsh create-react-app yarnpkg
我正在学习 Udemy 课程,我们将在其中使用create-react-app. 但是当我运行npm start和/或时yarn start,我收到错误。
这是课程:2020 年完成 React Developer(包含:Redux、Hooks、GraphQL)
\n\nnpx create-react-app test-npm (如果我使用 npm,则使用 --use-npm)
\n\n我们建议您首先输入:
\n\ncd 测试
\n npm start
快乐黑客!
\n\xe2\x9e\x9c 2020 年完成 React Developer(w:Redux、Hooks、GraphQL) cd test
\n\xe2\x9e\x9c test-npm git:(master) npm 或 yarn start
\n\n\nRun Code Online (Sandbox Code Playgroud)\ntest-npm@0.1.0 start /Users/user/Udemy/Complete React Developer in 2020 (w: Redux, Hooks, GraphQL)/test\nreact-scripts start\n
npm 结果:
\n\n\n\n\nRun Code Online (Sandbox Code Playgroud)\nsh: react-scripts: command not found \nnpm ERR! code ELIFECYCLE \nnpm ERR! syscall spawn \nnpm ERR! file sh \nnpm ERR! errno ENOENT \nnpm ERR! test@0.1.0 start: `react-scripts start` \nnpm ERR! spawn ENOENT \nnpm ERR! \nnpm ERR! Failed at the test-npm@0.1.0 start script. \nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in: \nnpm ERR! /Users/user/.npm/_logs/2020-01-23T18_09_30_919Z-debug.log\n
纱线结果:
\n\n\n\n\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x9e\x9c test-yarn git:(master) yarn start \nyarn run v1.21.1 \n$ react-scripts start \n/bin/sh: react-scripts: command not found \nerror Command failed with exit code 127. \ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n
我使用的是 mac(最新的 iOS),并使用 zsh 和 oh my zsh。
\n\n我的 .zshrc 文件:
\n\n(#) If you come from bash you might have to change your $PATH. \n(#) export PATH=$HOME/bin:/usr/local/bin:$PATH\n\n(#)Path to your oh-my-zsh installation. \nexport ZSH="/Users/mhagen/.oh-my-zsh"\n\nZSH_THEME="robbyrussell"\n\nplugins=(git nvm)\n\nsource $ZSH/oh-my-zsh.sh\n\nexport PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"\nRun Code Online (Sandbox Code Playgroud)\n\n我的 .bash_profile 文件:
\n\nexport NVM_DIR="$HOME/.nvm"\n[ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh" # This loads nvm\n[ -s "$NVM_DIR/bash_completion" ] && \\. "$NVM_DIR/bash_completion" # This loads nvm bash_completion\nRun Code Online (Sandbox Code Playgroud)\n\n我已经安装了:
\n\n\xe2\x9e\x9c ~ nvm --version\n0.35.2\n\xe2\x9e\x9c ~ node -v\nv13.7.0\n\xe2\x9e\x9c ~ npm -v\n6.13.6\n\xe2\x9e\x9c ~ yarn -v\n1.21.1\nRun Code Online (Sandbox Code Playgroud)\n\n我尝试删除node_modulespackage-lock/yarn 锁定文件,并使用 npm 和yarn 安装它们(每次都删除项目和新文件)。
我尝试在全球范围内安装 create-react-app 。但我发现的所有技巧都不起作用。
\n\n希望这里有人能看到我的问题是什么:/
\n这是对我有用的解决方案:/sf/answers/4146480551/ 项目路径中任何文件夹的名称中都不能有空格。
例如用户/项目 1/react // This cause the error。用户/项目1/反应// This is okay。
| 归档时间: |
|
| 查看次数: |
10003 次 |
| 最近记录: |