Visual Studio中的节点js项目错误。 “指定的路径,文件名或两者都太长”

时间:2014-02-10 14:53:50

标签: node.js visual-studio ntvs

我在Visual Studio 2013中创建了Blank Express应用程序。安装npm模块后,我运行它。它运行良好,没有错误。 但是,如果我关闭解决方案而不是再次打开项目加载错误,我会看到输出窗口中的错误说 “指定的路径,文件名或两者都太长。完全限定的文件名必须小于260”。 我该怎么办呢?

更新: csproj文件

    <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    <Name>ExpressApp7</Name>
    <RootNamespace>ExpressApp7</RootNamespace>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>83aac9f6-1094-40fc-8ce9-2ca0fe8ccbac</ProjectGuid>
    <ProjectHome>.</ProjectHome>
    <StartupFile>app.js</StartupFile>
    <SearchPath>
    </SearchPath>
    <WorkingDirectory>.</WorkingDirectory>
    <OutputPath>.</OutputPath>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
    <ProjectView>ProjectFiles</ProjectView>
    <NodejsPort>1337</NodejsPort>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="app.js" />
    <Compile Include="routes\index.js" />
    <Compile Include="routes\user.js" />
    <Content Include="package.json" />
    <Content Include="public\stylesheets\style.styl" />
    <Content Include="README.md" />
    <Content Include="views\index.jade" />
    <Content Include="views\layout.jade" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="public\" />
    <Folder Include="public\images\" />
    <Folder Include="public\javascripts\" />
    <Folder Include="public\stylesheets\" />
    <Folder Include="routes\" />
    <Folder Include="views\" />
  </ItemGroup>
  <Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>0</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl></IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>True</UseCustomServer>
          <CustomServerUrl></CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
        <WebProjectProperties>
          <StartPageUrl>
          </StartPageUrl>
          <StartAction>CurrentPage</StartAction>
          <AspNetDebugging>True</AspNetDebugging>
          <SilverlightDebugging>False</SilverlightDebugging>
          <NativeDebugging>False</NativeDebugging>
          <SQLDebugging>False</SQLDebugging>
          <ExternalProgram>
          </ExternalProgram>
          <StartExternalURL>
          </StartExternalURL>
          <StartCmdLineArguments>
          </StartCmdLineArguments>
          <StartWorkingDirectory>
          </StartWorkingDirectory>
          <EnableENC>False</EnableENC>
          <AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

1 个答案:

答案 0 :(得分:0)

您的文件中有多个路径变量与您的实际路径连接在一起。 例如:$(VSToolsPath)$(MSBuildExtensionsPath32)$(MSBuildExtensionsPath)

此外,您还有像这样的路径(很难识别为路径):

<WorkingDirectory>.</WorkingDirectory>

我打赌你的问题来自这里(第49行):

<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />

因此,请检查VisulaStudio设置中的默认路径,项目设置中的自定义路径,并尝试将每个路径移动到较低的目录级别。