• <i id='kKC8j'><tr id='kKC8j'><dt id='kKC8j'><q id='kKC8j'><span id='kKC8j'><b id='kKC8j'><form id='kKC8j'><ins id='kKC8j'></ins><ul id='kKC8j'></ul><sub id='kKC8j'></sub></form><legend id='kKC8j'></legend><bdo id='kKC8j'><pre id='kKC8j'><center id='kKC8j'></center></pre></bdo></b><th id='kKC8j'></th></span></q></dt></tr></i><div id='kKC8j'><tfoot id='kKC8j'></tfoot><dl id='kKC8j'><fieldset id='kKC8j'></fieldset></dl></div>
    <tfoot id='kKC8j'></tfoot>
    <legend id='kKC8j'><style id='kKC8j'><dir id='kKC8j'><q id='kKC8j'></q></dir></style></legend>

    <small id='kKC8j'></small><noframes id='kKC8j'>

      <bdo id='kKC8j'></bdo><ul id='kKC8j'></ul>

      1. 如何在 Visual Studio 2017 中使用 NPM 并安装包?

        How to use NPM and install packages inside Visual Studio 2017?(如何在 Visual Studio 2017 中使用 NPM 并安装包?)
        <tfoot id='QjL9y'></tfoot>

          <i id='QjL9y'><tr id='QjL9y'><dt id='QjL9y'><q id='QjL9y'><span id='QjL9y'><b id='QjL9y'><form id='QjL9y'><ins id='QjL9y'></ins><ul id='QjL9y'></ul><sub id='QjL9y'></sub></form><legend id='QjL9y'></legend><bdo id='QjL9y'><pre id='QjL9y'><center id='QjL9y'></center></pre></bdo></b><th id='QjL9y'></th></span></q></dt></tr></i><div id='QjL9y'><tfoot id='QjL9y'></tfoot><dl id='QjL9y'><fieldset id='QjL9y'></fieldset></dl></div>
          • <legend id='QjL9y'><style id='QjL9y'><dir id='QjL9y'><q id='QjL9y'></q></dir></style></legend>

            <small id='QjL9y'></small><noframes id='QjL9y'>

                <bdo id='QjL9y'></bdo><ul id='QjL9y'></ul>
                    <tbody id='QjL9y'></tbody>

                  本文介绍了如何在 Visual Studio 2017 中使用 NPM 并安装包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个简单的 Visual Studio 解决方案,运行 ASP.NET Core v2 并构建一个 React 应用程序.

                  现在,我想使用 NPM 安装一个简单的组件.在这个特定的例子中,它可能是:

                  npm install --save react-bootstrap-typeahead

                  我希望这个包只在我的解决方案中工作,而不是其他地方.

                  我的结果:

                  当我运行它时,我得到以下很好的错误,这显然是有道理的.如果 NPM 认为它可以在 'C:UsersLarsHoldgaardpackage.json' 处找到我的项目文件,那就不走运了.正确的路径是 C:UsersLarsHoldgaardDocumentsGithubLikvido.CreditRiskLikvido.CreditRiskLikvido.CreditRisk.

                  npm : npm WARN saveError ENOENT: 没有这样的文件或目录,打开 'C:UsersLarsHoldgaardpackage.json'在行:1 字符:1+ npm install --save react-bootstrap-typeahead+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (npm WARN saveEr...dpackage.json':String) [], RemoteException+ FullyQualifiedErrorId : NativeCommandErrornpm警告恩恩ENOENT:没有这样的文件或目录,打开 'C:UsersLarsHoldgaardpackage.json'npm警告grunt-sass@2.0.0 需要 grunt@>=0.4.0 的对等点,但没有安装.您必须自己安装对等依赖项.npm警告react-rating@1.0.6 需要一个 react@>=0.13.0 的对等体,但没有安装.您必须自己安装对等依赖项.npm警告react-bootstrap-typeahead@2.5.1 需要一个 react@^0.14.0 ||^15.2.0 ||^16.0.0 但没有安装.您必须自己安装对等依赖项.npm警告react-bootstrap-typeahead@2.5.1 需要一个 react-dom@^0.14.0 ||^15.2.0 ||^16.0.0 但没有安装.您必须自己安装对等依赖项.npm警告prop-types-extra@1.0.1 需要 react@>=0.14.0 的对等体,但没有安装.您必须自己安装对等依赖项.npm警告react-overlays@0.8.3 需要一个 react@^0.14.9 ||>=15.3.0 但没有安装.您必须自己安装对等依赖项.npm警告react-overlays@0.8.3 需要一个 react-dom@^0.14.9 ||>=15.3.0 但没有安装.您必须自己安装对等依赖项.npm警告react-onclickoutside@6.7.1 需要一个 react@^15.5.x ||^16.x 但没有安装.您必须自己安装对等依赖项.npm警告react-onclickoutside@6.7.1 需要 react-dom@^15.5.x 的 peer ||^16.x 但没有安装.您必须自己安装对等依赖项.npm警告react-transition-group@2.2.1 需要一个 react@>=15.0.0 的对等体,但没有安装.您必须自己安装对等依赖项.npm警告react-transition-group@2.2.1 需要一个 react-dom@>=15.0.0 的对等体,但没有安装.您必须自己安装对等依赖项.npm警告LarsHoldgaard 没有描述npm警告LarsHoldgaard 没有存储库字段.npm警告LarsHoldgaard 没有 README 数据npm警告LarsHoldgaard 没有许可证字段.

                  我的想法:

                  作为一个控制台菜鸟,我想我只需要更改我当前的文件夹.但是如果我运行 dir,我在正确的文件夹中,我可以看到我的 package.json 以及其他文件.

                  安装组件的正确方法是什么?

                  解决方案

                  为避免手动导航到正确的目录,请使用 Mads Kristensen 的打开命令行"扩展.它在市场上免费提供.您可以在

                  提示:使用键盘快捷键 ALT+Space 而不是上下文菜单来打开命令提示符.

                  然后你可以运行你的 npm 命令:

                  npm install react-bootstrap-typeahead

                  附带说明:从 npm 5.0.0 开始,已安装的模块默认添加为依赖项,因此不再需要 --save 选项.

                  2019 年更新:

                  开发人员命令提示符和开发人员 Power Shell 现在已集成到 Visual Studio 2019(16.2 预览版 2)中 - 不再需要扩展.

                  您可以在 Tools/Command Line

                  下找到它们

                  默认情况下没有分配快捷方式 - 所以你必须自己做.

                  I have a simple Visual Studio solution, running ASP.NET Core v2 and building a React app.

                  Now, I want to install a simple component using the NPM. In this particular example, it could be:

                  npm install --save react-bootstrap-typeahead
                  

                  I want this package to work just in my solution and nowhere else.

                  My result:

                  When I run this, I get the following nice error which obviously makes some sense. If NPM believes it can find my project file at 'C:UsersLarsHoldgaardpackage.json', it's out of luck. The correct path would be C:UsersLarsHoldgaardDocumentsGithubLikvido.CreditRiskLikvido.CreditRiskLikvido.CreditRisk .

                  npm : npm WARN saveError ENOENT: no such file or directory, open 'C:UsersLarsHoldgaardpackage.json'
                  At line:1 char:1
                  + npm install --save react-bootstrap-typeahead
                  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      + CategoryInfo          : NotSpecified: (npm WARN saveEr...dpackage.json':String) [], RemoteException
                      + FullyQualifiedErrorId : NativeCommandError
                  
                  npm
                  
                  WARN
                  
                  enoent
                   ENOENT: no such file or directory, open 'C:UsersLarsHoldgaardpackage.json'
                  
                  npm
                  
                  WARN
                   grunt-sass@2.0.0 requires a peer of grunt@>=0.4.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-rating@1.0.6 requires a peer of react@>=0.13.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-bootstrap-typeahead@2.5.1 requires a peer of react@^0.14.0 || ^15.2.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-bootstrap-typeahead@2.5.1 requires a peer of react-dom@^0.14.0 || ^15.2.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   prop-types-extra@1.0.1 requires a peer of react@>=0.14.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-overlays@0.8.3 requires a peer of react@^0.14.9 || >=15.3.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-overlays@0.8.3 requires a peer of react-dom@^0.14.9 || >=15.3.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-onclickoutside@6.7.1 requires a peer of react@^15.5.x || ^16.x but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-onclickoutside@6.7.1 requires a peer of react-dom@^15.5.x || ^16.x but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-transition-group@2.2.1 requires a peer of react@>=15.0.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   react-transition-group@2.2.1 requires a peer of react-dom@>=15.0.0 but none is installed. You must install peer dependencies yourself.
                  
                  npm
                  
                  WARN
                   LarsHoldgaard No description
                  
                  npm
                  
                  WARN
                   LarsHoldgaard No repository field.
                  
                  npm
                  
                  WARN
                   LarsHoldgaard No README data
                  
                  npm
                  
                  WARN
                   LarsHoldgaard No license field.
                  

                  My thinking:

                  Being a console noob, I would guess I just needed to change my current folder. But if I run dir, I am in the right folder, and I can see my package.json along with other files.

                  What is the right way to install components?

                  解决方案

                  To avoid navigating manually to the correct directory use the "Open Command Line" extension from Mads Kristensen. It is available for free in the Marketplace. You find it here.

                  Once installed you can open a command prompt conviently directly from within Visual Studio.

                  Tipp: Use the Keyboard Shortcut ALT+Space instead of the context menu to open the command prompt.

                  You can then run your npm command:

                  npm install react-bootstrap-typeahead
                  

                  As a side note: As of npm 5.0.0, installed modules are added as a dependency by default, so the --save option is no longer required.

                  Update 2019:

                  Developer Command Prompt and Developer Power Shell are now integrated into Visual Studio 2019 ( 16.2 Preview 2 ) - no need for an extension anymore.

                  You find them under Tools/Command Line

                  By default no shortcut is assigned - so you have to do this yourself.

                  这篇关于如何在 Visual Studio 2017 中使用 NPM 并安装包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  JSON.Net custom contract serialization and Collections(JSON.Net 自定义合约序列化和集合)
                  c# JSON Serialization Use Value Instead of Property Name(c# JSON序列化使用值而不是属性名)
                  Deserialize only one property of a JSON file(仅反序列化 JSON 文件的一个属性)
                  Method not found #39;Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)(找不到方法无效 Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)) - IT屋-
                  Automatically bind pascal case c# model from snake case JSON in WebApi(从 WebApi 中的蛇案例 JSON 自动绑定帕斯卡案例 c# 模型)
                  #39;Could not load type #39;Microsoft.AspNetCore.Mvc.MvcJsonOptions#39; from assembly #39;Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.0.0.0(无法从程序集Microsoft.AspNetCore.Mvc.Formatters.Json 加载类型Microsoft.AspNetCore.Mvc.MvcJso
                    <i id='mr1jZ'><tr id='mr1jZ'><dt id='mr1jZ'><q id='mr1jZ'><span id='mr1jZ'><b id='mr1jZ'><form id='mr1jZ'><ins id='mr1jZ'></ins><ul id='mr1jZ'></ul><sub id='mr1jZ'></sub></form><legend id='mr1jZ'></legend><bdo id='mr1jZ'><pre id='mr1jZ'><center id='mr1jZ'></center></pre></bdo></b><th id='mr1jZ'></th></span></q></dt></tr></i><div id='mr1jZ'><tfoot id='mr1jZ'></tfoot><dl id='mr1jZ'><fieldset id='mr1jZ'></fieldset></dl></div>
                  1. <tfoot id='mr1jZ'></tfoot>

                      <small id='mr1jZ'></small><noframes id='mr1jZ'>

                        <bdo id='mr1jZ'></bdo><ul id='mr1jZ'></ul>
                            <tbody id='mr1jZ'></tbody>
                          <legend id='mr1jZ'><style id='mr1jZ'><dir id='mr1jZ'><q id='mr1jZ'></q></dir></style></legend>