react-native - Windows 10 上的 React Native:npm install from mac 项目创建命令未找到问题
问题描述
我在尝试使用'npm install'命令安装反应本机节点模块时遇到奇怪的问题,该项目在mac机器上运行良好,但是当我在windows 10上运行它时;它最终出现错误消息,指出该命令失败为“。” (点)命令无法识别。
这是调试失败片段。我非常感谢任何人指导我解决这个问题。非常感谢。
2092 info run react-native-router-flux@4.0.6 postinstall node_modules/react-native-router-flux ./node_modules/.bin/opencollective postinstall
2093 info run react-native-router-flux@4.0.6 postinstall { code: 1, signal: null }
2094 info run native-base@2.12.1 postinstall { code: 0, signal: null }
2095 timing build:run:postinstall:node_modules/native-base Completed in 146ms
2096 timing reify:rollback:createSparse Completed in 4215ms
2097 timing reify:rollback:retireShallow Completed in 0ms
2098 timing command:install Completed in 37508ms
2099 verbose stack Error: command failed
2099 verbose stack at ChildProcess.<anonymous> (C:\Users\NAV\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
2099 verbose stack at ChildProcess.emit (node:events:390:28)
2099 verbose stack at maybeClose (node:internal/child_process:1064:16)
2099 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
2100 verbose pkgid react-native-router-flux@4.0.6
2101 verbose cwd E:\BFC-Caterer\bfc-caterer
2102 verbose Windows_NT 10.0.19042
2103 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\NAV\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i"
2104 verbose node v16.10.0
2105 verbose npm v7.24.1
2106 error code 1
2107 error path E:\BFC-Caterer\bfc-caterer\node_modules\react-native-router-flux
2108 error command failed
2109 error command C:\Windows\system32\cmd.exe /d /s /c ./node_modules/.bin/opencollective postinstall
2110 error '.' is not recognized as an internal or external command,
2110 error operable program or batch file.
2111 verbose exit 1
解决方案
首先,您是否在 Windows 系统上安装了节点?如果您不确定进入 cmd 并运行:
node -v
它应该为您提供一个版本,如果没有,请转到https://nodejs.org/en/download/并下载 Node.js 并安装它,然后再次进入 cmd 并运行上述命令。
这 '。' 不被识别为内部或外部命令错误通常与计算机找不到您要求启动的程序有关。转到 C:\Windows\system32\ 以查看程序“cmd.exe”是否确实存在,如果存在则转到您的环境变量并查看是否有路径:C:\Windows\system32\cmd .exe /d /s /c ./node_modules/.bin/opencollective。如果不添加它并尝试再次启动您的项目。
推荐阅读
- javascript - 谷歌脚本和电子邮件
- python - 使用 Scrapy 提取主页结果并继续到下一页
- mongodb - 我们可以安排一个作业将 json 文件从 GCS 加载到 GCE 上的 MongoDB
- node.js - Mongoose 填充新实例
- java - 相同的单击操作将不同的参数传递给鼠标侦听器。可能吗?
- c++ - 如何为 std::variant 赋值?
- python - 如何对多索引系列进行切片
- python-3.x - 在 Python 中使用 BeautifulSoup 和 Requests 抓取表数据
- tensorflow - 如何正确利用 GPU 能力?
- sql - SQL 使用联接并将 2 行从一个联接合并到具有不同列中的值的一行