我以前在全球范围内使用和安装了,但是当我尝试创建一个新的应用程序时,它不起作用。
所以我跟踪了这个:https://github.com/facebook/create-react-app/issues/8097没有工作。
然后我尝试这样做:卸载create-react app的问题,我得到了与这个问题相同的错误。
我也尝试过:https://github.com/facebook/create-react-app/issues/8088
https://icetutor.com/question/template-not-provided-using-create-react-app/,我真的不知道是什么问题。当我使用命令时
where create-react-app我拿到了这个:
C:\Users\PC 2\AppData\Local\Yarn\bin\create-react-app
C:\Users\PC 2\AppData\Local\Yarn\bin\create-react-app.cmd当我用这个:
npm rm -rf C:\Users\Weboffice PC 2\AppData\Local\Yarn\bin\create-react-app给出这个
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN saveError EPERM: operation not permitted, open 'C:\Users\package-lock.json.1678493388'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN Users No description
npm WARN Users No repository field.
npm WARN Users No README data
npm WARN Users No license field.
up to date in 0.058s当我用纱线安装时
C:\Users\Weboffice PC 2\React>yarn create react-app test
yarn create v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-react-app@3.3.0" with binaries:
- create-react-app########################################################################################################################################################################################## 225/225‘
C:\Users\Weboffice' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\Weboffice PC 2\AppData\Local\Yarn\bin\create-react-app
Arguments: test
Directory: C:\Users\Weboffice PC 2\React
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about
this command.当我用纱线卸载时
C:\Users\Weboffice PC 2\React>yarn uninstall create-react-app
yarn run v1.16.0
error Couldn't find a package.json file in "C:\\Users\\Weboffice PC
2\\React"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
this command问题更新。
发布于 2020-01-22 07:09:05
错误显示用户名中的空格存在问题(这是npx的一个已知问题,修复程序正在缓慢地使用工作过)。
同时,这里有一个解决办法
我能够在Windows中修复这个问题,方法是为我的用户文件夹创建一个没有空间的目录连接。您可以在管理的powershell中运行这样的命令:
cmd /c mklink /J C:\Users\myname" "C:\Users\My Name"然后,您可以像使用真正的用户目录一样使用这个连接:npm config set cache C:\Users\myname\AppData\Roaming\npm-cachenpm config set prefix C:\Users\myname\AppData\Roaming\npm(上面应该更新您的用户.npmrc文件)
https://stackoverflow.com/questions/59834706
复制相似问题