[英]First app with create-react-app, npm start not working
我正在尝试创建我的第一个 React 应用程序并基本上在步骤 1 中遇到问题。我正在尝试在默认的 create-react-app 安装上使用 npm start 并且出现以下错误。 我已经包含了显示 create-react-app 成功运行的屏幕截图,但这并没有解决任何问题。 我已经包含了它成功运行 create-react-app 和我运行 npm start 但没有运气的截图。 谢谢。
这是日志文件:
18 详细 npm v6.4.1 19 错误文件 sh 20 错误代码 ELIFECYCLE 21 错误 errno ENOENT 22 错误系统调用 spawn 23 错误 robofriends@0.1.0 start: react-scripts start
23 错误 spawn ENOENT 24 错误在 robofriends@0.0. 失败脚本。 24 错误 这可能不是 npm 的问题。 上面可能有额外的日志输出。 25 详细退出 [ 1, true ]
我尝试了这个解决方案,但它对我不起作用:
stackoverflow.com/a/42539669/5069226
看起来这与您的工作区路径有关。
我尝试使用路径/tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React:Redux/robofriends
在我的机器上复制它,并且我能够重现您的错误。
╭─ /tmp/Users/Neil/Desktop/Complete Web Developer/Section
18_React:Redux/robofriends
╰ yarn start K8S: tools 11:37:33
yarn run v1.7.0
$ react-scripts start
/bin/sh: react-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
但是当我将robofriends
目录移到树中更高的位置时,它运行良好。
╭─ /tmp/Users/robofriends
╰ yarn start K8S: tools INT(-2) ↵ 11:38:34
yarn run v1.7.0
Starting the development server...
我猜它可能是节点模块的长路径或路径中的非字母字符, :
, _
。 所以我回到React:Redux
目录并将其重命名为...React_Redux
并在 /tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React_Redux/robofriends` 中再次尝试npm start
,它工作得很好: )
所以看起来npm
不喜欢:
在可执行路径中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.