代码之家  ›  专栏  ›  技术社区  ›  Ya Wang

visual studio npm安装错误的目录?SPA角度

  •  0
  • Ya Wang  · 技术社区  · 7 年前

    随着新的Visual Studio更新,我相信它破坏了npm的连接。

    我得到这个错误:

    npm WARN saveError ENEONT:没有这样的文件或目录,请打开“C:\ DDD\u OneSystem\Presentation\Supply Chain\package.json”

    我该如何指出clientapp package.json 真的需要吗?查看 .csproj

    还原包时

    PATH=C:\Program Files\nodejs;.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\NodeJs\win-x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\NodeJs;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin
    "C:\Program Files\nodejs\npm.CMD" install
    

    npm WARN saveError ENEONT:没有这样的文件或目录,请打开“C:\ DDD\u OneSystem\Presentation\Supply Chain\package.json”

    npm WARN enonent enoint:没有这样的文件或目录,请打开“C:\DDD\u OneSystem\Presentation\Supply Chain\package.json”
    npm警告供应链无描述
    npm警告供应链没有存储库字段。
    npm警告供应链没有自述数据
    npm警告供应链无许可证字段。
    0.254中的最新版本
    发现0个漏洞

    enter image description here

    .csproj公司

    <Project Sdk="Microsoft.NET.Sdk.Web">
    
      <PropertyGroup>
        <TargetFramework>netcoreapp2.2</TargetFramework>
        <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
        <TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
        <IsPackable>false</IsPackable>
        <SpaRoot>ClientApp\</SpaRoot>
        <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>
        <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
    
        <!-- Set this to true if you enable server-side prerendering -->
        <BuildServerSideRenderer>false</BuildServerSideRenderer>
        <RootNamespace>Supply_Chain</RootNamespace>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="AutoMapper" Version="8.0.0" />
        <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
        <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="6.0.1" />
        <PackageReference Include="Microsoft.AspNetCore.App" />
        <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
        <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="4.0.1" />
      </ItemGroup>
    
      <ItemGroup>
        <!-- Don't publish the SPA source files, but do show them in the project files list -->
        <Content Remove="$(SpaRoot)**" />
        <None Remove="$(SpaRoot)**" />
        <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
      </ItemGroup>
    
      <ItemGroup>
        <None Remove="ClientApp\package.json" />
        <None Remove="ClientApp\src\app\components\product\product-supplier-search.component.ts" />
        <None Remove="ClientApp\src\app\components\supplier\supplier-shipments.datatable.component.ts" />
        <None Remove="ClientApp\src\app\global.d.ts" />
        <None Remove="ClientApp\src\app\pages\product\product-search.page.ts" />
        <None Remove="ClientApp\src\app\pages\supplier\supplier-shipments.page.ts" />
        <None Remove="ClientApp\src\app\services\shared\datatable-service.ts" />
      </ItemGroup>
    
      <ItemGroup>
        <Content Include="ClientApp\package.json" />
      </ItemGroup>
    
      <ItemGroup>
        <ProjectReference Include="..\..\OneSystem.Infrastructure\OneSystem.Infrastructure.csproj" />
        <ProjectReference Include="..\..\OneSystem.Persistance\OneSystem.Persistance.csproj" />
      </ItemGroup>
    
      <ItemGroup>
        <TypeScriptCompile Include="ClientApp\src\app\components\product\product-supplier-search.component.ts" />
        <TypeScriptCompile Include="ClientApp\src\app\components\supplier\supplier-shipments.datatable.component.ts" />
        <TypeScriptCompile Include="ClientApp\src\app\pages\product\product-search.page.ts" />
        <TypeScriptCompile Include="ClientApp\src\app\pages\supplier\supplier-shipments.page.ts" />
        <TypeScriptCompile Include="ClientApp\src\app\services\shared\datatable-service.ts" />
      </ItemGroup>
    
      <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>
    
      <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
        <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
        <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
        <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
        <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
    
        <!-- Include the newly-built files in the publish output -->
        <ItemGroup>
          <DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
          <DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
          <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
            <RelativePath>%(DistFiles.Identity)</RelativePath>
            <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
          </ResolvedFileToPublish>
        </ItemGroup>
      </Target>
    
      <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
        <TypeScriptTarget>ES5</TypeScriptTarget>
        <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
        <TypeScriptModuleKind />
        <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
        <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
        <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
        <TypeScriptOutFile />
        <TypeScriptOutDir />
        <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
        <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
        <TypeScriptSourceMap>True</TypeScriptSourceMap>
        <TypeScriptMapRoot />
        <TypeScriptSourceRoot />
      </PropertyGroup>
    
    </Project>
    
    0 回复  |  直到 7 年前
        1
  •  0
  •   Ya Wang    7 年前

    在调试中似乎可以,您不能使用还原包。因为新的angularcli使用的是angularcli,它处理的不是visual studio。

    记住,这是angularcli而不是visual studio不要像我一样搞糊涂!