“无法确定NodeJ的路径。请检查NodeJ是否已安装。”错误

时间:2017-01-17 07:06:53

标签: javascript node.js xml

我是第一次制作应用程序,但是这个错误没有得到解决,因为我已经尝试了很多来解决它,但没有任何作用:

  

“无法确定NodeJ的路径。请检查NodeJ是否已安装。”

文件microsoft.MDA.target 235中有错误... 下载节点js文件后也......我必须把节点js文件放到路径确定或者它默认采取什么?我无法运行我的应用程序,因为它使我在经过大量研究后更难理解错误。 这是定义microsoft.mda.traget文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <UsingTask TaskName="RunMdaTargetsInstall" AssemblyFile="Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.dll"/>
  <UsingTask TaskName="MdaTrackJsChanges" AssemblyFile="Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.dll"/>
  <UsingTask TaskName="CreateBuildInfoMetadata" AssemblyFile="Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.dll"/>
  <UsingTask TaskName="ExportRemoteIosCertificates" AssemblyFile="Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.dll"/>
  <UsingTask TaskName="MdaVsCli" AssemblyFile="Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.dll"/>

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <LaunchApplication Condition=" '$(LaunchApplication)' == '' ">true</LaunchApplication>
    <AllowLocalNetworkLoopback Condition=" '$(AllowLocalNetworkLoopback)' == '' ">true</AllowLocalNetworkLoopback>
    <DebuggerType Condition=" '$(DebuggerType)' == '' ">Script</DebuggerType>
    <RequireAuthentication Condition=" '$(RequireAuthentication)' == '' ">true</RequireAuthentication>
    <OutputPath Condition=" '$(OutputPath)' == '' and '$(Platform)' != 'AnyCPU' ">bin\$(Platform)\$(Configuration)</OutputPath>
    <OutputPath Condition=" '$(OutputPath)' == '' and '$(Platform)' == 'AnyCPU' ">bin\$(Configuration)</OutputPath>
    <BaseIntermediateOutputPath>bld\</BaseIntermediateOutputPath>
    <SuppressOutOfDateMessageOnBuild>true</SuppressOutOfDateMessageOnBuild>
    <DebugSymbols>false</DebugSymbols>
    <WinRTReferenceTabs>TAB_SDK_EXTENSIONS</WinRTReferenceTabs>
    <SkipCopyBuildProduct>true</SkipCopyBuildProduct>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    <CustomDeployTargetsPath>$(VSToolsPath)\MDA\DeployTargets</CustomDeployTargetsPath>
    <IsWindowsPlatform>false</IsWindowsPlatform>
    <IsWindowsPlatform Condition="$(Platform) == 'Windows-AnyCPU' OR $(Platform) == 'Windows-x86' OR $(Platform) == 'Windows-x64' OR $(Platform) == 'Windows-ARM'">true</IsWindowsPlatform>

    <PlatformTarget Condition="'$(PlatformTarget)' ==''">$(Platform)</PlatformTarget>
    <DebuggerFlavor Condition=" '$(DebuggerFlavor)' == '' and '$(Platform)' != 'ARM' and '$(Platform)' != 'AnyCPU' and '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">WindowsPhoneEmulatorDebugger</DebuggerFlavor>
    <DebuggerFlavor Condition=" '$(DebuggerFlavor)' == '' and '$(Platform)' == 'AnyCPU' and '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp'">WindowsPhoneEmulatorDebugger</DebuggerFlavor>
    <DebuggerFlavor Condition=" '$(DebuggerFlavor)' == '' and '$(Platform)' == 'ARM' and '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">AppHostDeviceDebugger</DebuggerFlavor>
    <DebuggerFlavor Condition=" '$(DebuggerFlavor)' == '' and '$(Platform)' != 'ARM' and '$(TargetPlatformIdentifier)' != 'WindowsPhoneApp'">AppHostLocalDebugger</DebuggerFlavor>
    <DebuggerFlavor Condition=" '$(DebuggerFlavor)' == '' and '$(Platform)' == 'ARM' ">AppHostRemoteDebugger</DebuggerFlavor>

    <!-- Set a default DebuggerFlavor value in case all the other SETs failed -->
    <DebuggerFlavor Condition=" '$(DebuggerFlavor)' == ''">AppHostLocalDebugger</DebuggerFlavor>

    <WindowsAppContainer>true</WindowsAppContainer>
    <AppxPackage>true</AppxPackage>

    <TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
    <TargetPlatformVersion>8.0</TargetPlatformVersion>

  </PropertyGroup>

  <ItemGroup>
    <ProjectCapability Include="Cordova"/>
    <ProjectCapability Include="HtmlMultiDeviceDevelopment"/>
    <ProjectCapability Include="MicrosoftHtmlMultiDeviceDevelopment"/>
  </ItemGroup>

  <!-- 'Windows Phone' platform should only be used for backward compatibility. Platform was renamed to 'Windows Phone 8'. -->
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\PhoneLaunch.targets" Condition="$(Platform) == 'Windows Phone' OR $(Platform) == 'Windows Phone 8'" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\Phone81Launch.targets" Condition="$(Platform) == 'Windows Phone (Universal)'" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\AndroidLaunch.targets" Condition="$(Platform) == 'Android'" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\iOSLaunch.targets" Condition="$(Platform) == 'iOS'" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CordovaTools\vs-mda-targets\WindowsLaunch.targets" Condition="'$(IsWindowsPlatform)' == 'true'" />
  <!-- Import custom deploy providers, if they exist -->
  <Import Project="$(CustomDeployTargetsPath)\Android\*.targets" Condition="$(Platform) == 'Android' AND Exists('$(CustomDeployTargetsPath)\Android')"/>
  <Import Project="$(CustomDeployTargetsPath)\iOS\*.targets" Condition="$(Platform) == 'iOS' AND Exists('$(CustomDeployTargetsPath)\iOS')"/>
  <Import Project="$(CustomDeployTargetsPath)\WindowsPhone\*.targets" Condition="$(Platform) == 'Windows Phone' AND Exists('$(CustomDeployTargetsPath)\WindowsPhone')"/>
  <Import Project="$(CustomDeployTargetsPath)\Windows\*.targets" Condition="'$(IsWindowsPlatform)' == 'true' AND Exists('$(CustomDeployTargetsPath)\Windows')"/>

  <PropertyGroup>
    <JSTargetDir>$(VSToolsPath)\JavaScript</JSTargetDir>
  </PropertyGroup>

  <Import Project="$(JSTargetDir)\Microsoft.VisualStudio.JavaScript.Common.targets" />

  <ItemGroup>
    <PropertyPageSchema Include="$(JSTargetDir)\General.neutral.xaml;">
      <Context>Project</Context>
    </PropertyPageSchema>
  </ItemGroup>

  <ItemGroup>
    <ProjectCapability Include="AllTargetOutputGroups;VisualStudioWellKnownOutputGroups" />
  </ItemGroup>

  <PropertyGroup>
    <AvailablePlatforms>Android,iOS,Windows-AnyCPU,Windows-x64,Windows-x86,Windows-ARM,Windows Phone,Windows Phone 8,Windows Phone (Universal)</AvailablePlatforms>
    <OsVersion>$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@CurrentVersion)</OsVersion>
  </PropertyGroup>

  <ItemGroup>
    <MDACpuSpecificPlatform Include="Windows-AnyCPU" />
    <MDACpuSpecificPlatform Include="Windows-x64" />
    <MDACpuSpecificPlatform Include="Windows-x86" />
    <MDACpuSpecificPlatform Include="Windows-ARM" />
  </ItemGroup>

  <!-- Build info metadata items. -->
  <ItemGroup Label="BuildInfoMetadata">

    <BuildInfoMetadata Include="VisualStudio">
      <Version>$(VisualStudioVersion)</Version>
    </BuildInfoMetadata>

    <BuildInfoMetadata Include="VisualStudioEdition"
                       Condition="'$(VisualStudioEdition)' != ''">
      <Value>$(VisualStudioEdition)</Value>
    </BuildInfoMetadata>

    <BuildInfoMetadata Include="$(ComSpec)">
      <Name>OperatingSystem</Name>
    </BuildInfoMetadata>

    <BuildInfoMetadata Include="ProjectGUID"
                          Condition="'$(ProjectGUID)' != ''">
      <Value>$(ProjectGUID)</Value>
    </BuildInfoMetadata>

  </ItemGroup>

  <!-- Overriding targets which when absent cause warnings from common targets -->
  <Target Name="BeforeBuild">
  </Target>

  <PropertyGroup>
    <MDABuildDependsOn Condition="'$(DebuggerFlavor)' != ''">$(MDABuildDependsOn)TrackJsChanges;</MDABuildDependsOn>
    <BuildDependsOn Condition="$(OsVersion) == '6.1' AND '$(Platform)' != '' AND $(Platform.Substring(0,3)) == 'Win'">$(BuildDependsOn);BuildMDAWin7</BuildDependsOn>
    <BuildDependsOn Condition="'$(DebuggerFlavor)' != '' AND $(DebuggerFlavor.Substring(0,6)) != 'Ripple'">$(BuildDependsOn);BuildOnlySettings;BuildMDA</BuildDependsOn>
    <BuildDependsOn Condition="'$(DebuggerFlavor)' != '' AND $(DebuggerFlavor.Substring(0,6)) == 'Ripple'">$(BuildDependsOn);BuildOnlySettings;BuildRipple</BuildDependsOn>
    <MDACustomErrorRegEx>Package name must look like: </MDACustomErrorRegEx>
  </PropertyGroup>

  <PropertyGroup>
    <MdaVsCliProjectDir Condition="'$(MdaVsCliProjectDir)' == ''">.</MdaVsCliProjectDir>
  </PropertyGroup>

  <Target Name="CoreBuild" />

  <Target Name="BuildMDAWin7">
    <Error Text="Windows 8 or higher is required to build for Windows or Windows Phone." />
  </Target>

  <Target Name="BuildMDA" DependsOnTargets="$(MDABuildDependsOn)EnsureNodeJsRequirementsAreAtCorrectVersion;">
    <Error Condition="$(Platform) == 'iOS' AND $(iOSRemoteBuildSecurityPIN) == 'NULL'" Text="Visual Studio is not paired with a remote build server. To pair with one, update and start vs-mda-remote and verify your information in Tools, Options, Tools for Apache Cordova, Remote Agent Configuration. Visual Studio will pair with the agent upon clicking OK. See http://go.microsoft.com/fwlink/?LinkID=511904"/>

    <ItemGroup>
      <BuildMDACpuSpecificPlatform Include="@(MDACpuSpecificPlatform)" Condition=" '%(Identity)' == '$(Platform)' " />
    </ItemGroup>

    <CreateBuildInfoMetadata Condition=" '$(Platform)' == 'android' "
                             TargetPath="$(OutputPath)VSBuildInfo.xml"
                             OutputFormat="Xml"
                             BuildInfoMetadata="@(BuildInfoMetadata)"/>

    <CreateBuildInfoMetadata Condition=" '@(BuildMDACpuSpecificPlatform)' != '' "
                             TargetPath="$(OutputPath)Microsoft.AppxPackage.Metadata.Overrides.props"
                             OutputFormat="MSBuild"
                             BuildInfoMetadata="@(BuildInfoMetadata)"/>

    <ExportRemoteIosCertificates TargetPath="$(AppData)\Microsoft\VisualStudio\MDA\certs\vs-mda-remote-client.pfx" Condition="$(Platform) == 'iOS' AND $(iOSRemoteBuildSecurityPIN) != ''" />

    <!-- Using ToolTask for CPU specific platforms (all Windows, such as Windows-AnyCPU) we need to include the cpuType as an option on the command line that launches the process (reason is deep within the external build.) No need to pass in build server or build target -->
    <MdaVsCli
      NpmInstallDir="$(NpmInstallDir)"
      Platform="$(Platform)"
      ProjectDir="$(MdaVsCliProjectDir)"
      Configuration ="$(Configuration)"
      ProjectName ="$(ProjectName)"
      Language ="$(LangName)"
      Condition=" '@(BuildMDACpuSpecificPlatform)' != '' "
    />

    <!-- ToolTask for all other platforms -->
    <MdaVsCli
      NpmInstallDir="$(NpmInstallDir)"
      Platform="$(Platform)"
      ProjectDir="$(MdaVsCliProjectDir)"
      Configuration ="$(Configuration)"
      ProjectName ="$(ProjectName)"
      Language ="$(LangName)"
      BuildServerUrl="$(iOSRemoteBuildServer)"
      BuildTarget="$(DebuggerFlavor)"
      Condition=" '@(BuildMDACpuSpecificPlatform)' == '' "
    />

    <WriteLinesToFile Condition="$(CordovaVersion) != ''" File="$(ProjectDir)\bld\$(Configuration)\platforms\cli-version" Lines="$(CordovaVersion)" Overwrite="true" Encoding="Unicode" ContinueOnError="true" />

  </Target>

  <Target Name="BuildRipple" DependsOnTargets="$(MDABuildDependsOn)PrepareForRippleRequirements">
    <!-- Launching Ripple emulator needs at least an empty platforms directory so let's make sure there is one -->
    <MakeDir Directories="bld\Ripple\$(Platform)\$(Configuration)\platforms"/>

    <WriteLinesToFile Condition="$(CordovaVersion) != ''" File="$(ProjectDir)\bld\$(Configuration)\platforms\cli-version" Lines="$(CordovaVersion)" Overwrite="true" Encoding="Unicode" ContinueOnError="true" />
  </Target>

  <Target Name="MDACleanAfterInstall">
    <CallTarget Targets="CleanCordovaDeploy" />
    <CreateItem Include="$(ProjectDir)\bld\**\*" Exclude="$(ProjectDir)\bld\Ripple\$(Platform)\$(Configuration)\JsFileList.JSON">
      <Output TaskParameter="Include" ItemName="FilesFoundInBld"/>
    </CreateItem>
    <Delete Files="@(FilesFoundInBld)" TreatErrorsAsWarnings="true"/>
    <ItemGroup>
      <_MdaDirectoriesToCleanup Include="$([System.IO.Directory]::GetDirectories('bld\Debug'))" Condition=" EXISTS('bld\Debug') " />
      <_MdaDirectoriesToCleanup Include="$([System.IO.Directory]::GetDirectories('bld\Release'))" Condition=" EXISTS('bld\Release') " />
      <_MdaDirectoriesToCleanup Include="$([System.IO.Directory]::GetDirectories('bld\Distribution'))" Condition=" EXISTS('bld\Distribution') " />
    </ItemGroup>
    <RemoveDir Directories="@(_MdaDirectoriesToCleanup)" Condition="Exists('%(Identity)')" ContinueOnError="true" />
  </Target>

  <Target Name="InstallMDATargets">
    <RunMdaTargetsInstall MdaVsixDir="$(MDAVsixDir)"
        NodeInstallPath="$(NodeJsDir)"
        NpmInstallDir="$(NpmInstallDir)"
        LangName="$(LangName)"
        ProjectDir="$(MdaVsCliProjectDir)"
        Configuration="$(Configuration)">
      <Output TaskParameter="MdaInstallErrorCode" PropertyName="MDAInstallErrorCode"/>
      <Output TaskParameter="CordovaVersion" PropertyName="CordovaVersion"/>
    </RunMdaTargetsInstall>

    <CallTarget Targets='MDACleanAfterInstall' Condition="$(MDAInstallErrorCode) == '-17'" />

    <Error Condition="$(MDAInstallErrorCode) != '0' And $(MDAInstallErrorCode) != '-17'" Text="Error installing local npm package." />
  </Target>

  <Target Name="TrackJsChanges" DependsOnTargets="CompileTypescript">
    <PropertyGroup>
      <RippleBldDir Condition="$(DebuggerFlavor.Substring(0,6)) == 'Ripple'">bld\Ripple\$(Platform)\$(Configuration)</RippleBldDir>
    </PropertyGroup>

    <Message Text="GeneratedJavascript=@(GeneratedJavascript)" Importance="High"/>
    <MakeDir Directories="$(RippleBldDir)" Condition="$(DebuggerFlavor.Substring(0,6)) == 'Ripple' And !Exists('$(RippleBldDir)')" />
    <MdaTrackJsChanges Condition="'$(DebuggerFlavor)' != '' AND $(DebuggerFlavor.Substring(0,6)) == 'Ripple'" GeneratedJavascript="@(GeneratedJavascript)" OutputFolder="$(RippleBldDir)"></MdaTrackJsChanges>
    <MdaTrackJsChanges Condition="'$(DebuggerFlavor)' != '' AND $(DebuggerFlavor.Substring(0,6)) != 'Ripple'" GeneratedJavascript="@(GeneratedJavascript)" OutputFolder="bld\$(Platform)\$(Configuration)"></MdaTrackJsChanges>
  </Target>

  <Target Name="EnsureNodeJsRequirementsAreAtCorrectVersion">
    <!-- These errors will trigger if building from inside Visual Studio and requirements could not be determined -->
    <Error Condition="$(MDAPropertiesEvaluated) == 'true' And $(NodeJsDir) == ''" Text="Path to NodeJs could not be determined. Please check that NodeJs has been installed." />
    <Error Condition="$(MDAPropertiesEvaluated) == 'true' And $(MDAVsixDir) == ''" Text="Path to the Visual Studio Extension for Tools for Apache Cordova could not be determined. Please check that the extension has been installed." />

    <!-- These errors will trigger if building from outside Visual Studio (e.g. command line) and environment variables have not been set -->
    <Error Condition="$(MDAPropertiesEvaluated) == '' And $(NodeJsDir) == ''" Text="Path to NodeJs has not been specified. Please check that NodeJs has been installed and set the NodeJsDir environment variable before building." />
    <Error Condition="$(MDAPropertiesEvaluated) == '' And $(MDAVsixDir) == ''" Text="Path to Visual Studio Extension for Tools for Apache Cordova has not been specified. Please install it and set the MDAVsixDir environment variable before building." />

    <!-- Sanity check that things exist in the specified places. These are more likely to fail if building outside Visual Studio and the required environment variables have not been set, or set incorrectly. -->
    <Error Condition="!Exists('$(NodeJsDir)') Or !Exists('$(NodeJsDir)\node.exe')" Text="The specified NodeJs directory $(NodeJsDir) either does not exist, or does not contain node.exe. Please check that NodeJs has been installed, and set the NodeJsDir variable to the correct directory." />
    <Error Condition="!Exists('$(MDAVsixDir)') Or !Exists('$(MDAVsixDir)\packages\vs-mda')" Text="The specified directory to the Visual Studio extension $(MDAVsixDir)\node.exe either does not exist, or does not contain a packages\vs-mda sub-directory. Please check that the extension directory exists and set the MDAVsixDir variable to the correct directory." />

    <!-- Installs (if necessary) the supporting Nodejs module -->
    <CallTarget Targets='InstallMDATargets' />
  </Target>

  <!-- Will execute when config.xml in project is newer than the one in android under platforms (which covers the case when the one in android does not yet exist) -->
  <Target Name="PrepareForRippleRequirements" Inputs="config.xml" Outputs="bld\$(Configuration)\platforms\android\assets\www\config.xml">
    <CallTarget Targets="EnsureNodeJsRequirementsAreAtCorrectVersion"/>
    <!-- Build: args to vs-cli are: buildCommand platform configuration projectSourceDir projectName optional_tscExePath -->

    <MdaVsCli
      NpmInstallDir="$(NpmInstallDir)"
      Platform="$(Platform)"
      ProjectDir="$(MdaVsCliProjectDir)"
      Configuration ="$(Configuration)"
      ProjectName ="$(ProjectName)"
      Language ="$(LangName)"
      BuildTarget="$(DebuggerFlavor)"
      />
  </Target>

  <Target Name="AfterBuild">
  </Target>

  <!-- This tries to delete the bin directory in the CordovaDeploy project in the WP8 platform -->
  <Target Name="CleanCordovaDeploy">
    <ItemGroup>
      <CordovaDeployDirs Include="$(ProjectDir)\bld\$(Configuration)\platforms\wp8\cordova\lib\CordovaDeploy\CordovaDeploy\bin" />
    </ItemGroup>

    <!-- Treating the error as a warning allows us to specify our own error message later. -->
    <RemoveDir Directories="@(CordovaDeployDirs)" ContinueOnError="true">
      <Output TaskParameter="RemovedDirectories" ItemName="DeletedDirectories" />
    </RemoveDir>

    <Error Condition="@(CordovaDeployDirs) != @(DeletedDirectories)" Text="Unable to clean your project while your app is running on a Windows Phone emulator or device. Shut down the Windows Phone emulator and try again." />
  </Target>

  <Target Name="BeforeClean">

    <CallTarget Targets="CleanCordovaDeploy" />

    <ItemGroup>
      <_MdaDirectoriesToCleanup Include="$([System.IO.Directory]::GetDirectories('bld\$(Configuration)'))" Condition=" EXISTS('bld\$(Configuration)') " />
      <_MdaDirectoriesToCleanup Include="bld\Android\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bld\iOS\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bld\Windows*\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bld\Ripple\Android\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bld\Ripple\iOS\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bld\Ripple\Windows*\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bin\Android\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bin\iOS\$(Configuration)"/>
      <_MdaDirectoriesToCleanup Include="bin\Windows*\$(Configuration)"/>
    </ItemGroup>

    <RemoveDir Directories="@(_MdaDirectoriesToCleanup)" Condition="Exists('%(Identity)')" ContinueOnError="true" />

    <!-- Remove all the specific plugin directories, but keep the root 'plugins' directory. -->
    <PropertyGroup>
      <_MdaPluginsDirectoryExists Condition="Exists('bld\$(Configuration)\plugins')">true</_MdaPluginsDirectoryExists>
    </PropertyGroup>

    <RemoveDir Directories="bld\$(Configuration)\plugins" Condition=" '$(_MdaPluginsDirectoryExists)' == 'true' " ContinueOnError="true" />
    <MakeDir Directories="bld\$(Configuration)\plugins" Condition=" '$(_MdaPluginsDirectoryExists)' == 'true' " />

  </Target>
</Project>

0 个答案:

没有答案