设置 Visual Studio 时验证 m1 pro mac 中的节点安装时出现问题
我正在尝试在 M1 pro mac arm64 中设置 Visual studio 2019 以使用 Vue.js 进行 .Net 开发。我有我的团队成员提供的起始代码。他们使用窗口机器并且运行没有问题。但是,当我尝试构建项目时,我不断收到错误消息,指出未安装 Node。 Visual Studio 中的错误
我很确定我安装了它,因为我经常用来运行 React 应用程序。它现在正在 intel 模式下运行,但它也为 arm64 模式提供相同的响应。我想指出的是,我已经使用 nvm 来安装我的节点包。这是我在 vscode 终端中的控制台输出:
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking % node --version
v14.17.5
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking % which node
/Users/prabalchhatkuli/.nvm/versions/node/v14.17.5/bin/node
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking % arch
i386
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking %
我正在尝试运行 .csproj 文件的这一部分:
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
我对此没有解释,因为节点 --version 在 Rosetta2 终端以及本机终端中都有效终端。
I am trying to setup Visual studio 2019 for .Net development with Vue.js in a M1 pro mac arm64. I have a starter code that my team member provided. They use a window machine and they are running it without issue. However, when I try to build the project I keep getting an error saying that Node was not installed.
Error in visual studio
I am pretty sure I installed it because I regularly use to run React apps. It is running in the intel mode right now but it gives the same response for the arm64 mode as well. I would like to point out that I have used nvm to install my node package. This is my console output in the terminal for vscode:
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking % node --version
v14.17.5
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking % which node
/Users/prabalchhatkuli/.nvm/versions/node/v14.17.5/bin/node
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking % arch
i386
prabalchhatkuli@Prabals-MacBook-Pro TimeTracking %
And I am trying to run this part of the .csproj file:
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
I don't have an explanation for this because the node --version works in the rosetta2 terminal as well as the native terminal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此答案解决了该问题:https://stackoverflow.com/a/26320915/8183226。
结果节点不在我的 /usr/local/bin 目录中,所以我创建了一个符号链接
This answer resolves the issue: https://stackoverflow.com/a/26320915/8183226.
Turns out node wasn't in my /usr/local/bin directory so I created a symlink