1. <tfoot id='DVNuk'></tfoot>
      <i id='DVNuk'><tr id='DVNuk'><dt id='DVNuk'><q id='DVNuk'><span id='DVNuk'><b id='DVNuk'><form id='DVNuk'><ins id='DVNuk'></ins><ul id='DVNuk'></ul><sub id='DVNuk'></sub></form><legend id='DVNuk'></legend><bdo id='DVNuk'><pre id='DVNuk'><center id='DVNuk'></center></pre></bdo></b><th id='DVNuk'></th></span></q></dt></tr></i><div id='DVNuk'><tfoot id='DVNuk'></tfoot><dl id='DVNuk'><fieldset id='DVNuk'></fieldset></dl></div>
    2. <small id='DVNuk'></small><noframes id='DVNuk'>

      1. <legend id='DVNuk'><style id='DVNuk'><dir id='DVNuk'><q id='DVNuk'></q></dir></style></legend>
          <bdo id='DVNuk'></bdo><ul id='DVNuk'></ul>
      2. 如何为项目指定本地版本的 Node?

        时间:2023-10-13

        <tfoot id='RaOew'></tfoot>
          <bdo id='RaOew'></bdo><ul id='RaOew'></ul>
        • <legend id='RaOew'><style id='RaOew'><dir id='RaOew'><q id='RaOew'></q></dir></style></legend>

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

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

                  <tbody id='RaOew'></tbody>
                • 本文介绍了如何为项目指定本地版本的 Node?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个项目,我们试图让 Node 启动并在多个开发人员的机器上运行.问题在于,并非所有开发人员都是 Node(甚至 JavaScript)开发人员,我们希望确保他们拥有运行特定项目所需的 Node 版本(开发人员将在他们的机器上拥有多个 Node 项目).

                  I've got a project where we're trying to get Node up and running across multiple developers' machines. The problem is that not all of the developers are Node (or even JavaScript) developers, and we want to ensure that they have the Node version necessary to run a specific project (developers will have multiple Node projects on their machines).

                  我读到了 package.json 的engines"字段,但我似乎找不到任何方法来安装我需要的 Node 版本.为了测试,我通过 NVM 将我当前的节点版本设置为 v0.10.29,创建了一个 package.json 指定 v0.11.13 的必要引擎,并尝试通过 node 命令以及通过一个 package.json 定义的 npm start 命令.

                  I read about package.json's "engines" field, but I couldn't seem to find any way to get the version of Node installed that I needed. To test, I set my current node version to v0.10.29 via NVM, created a package.json specifying a necessary engine of v0.11.13, and tried to start Node via the node command as well as via a package.json-defined npm start command.

                  blackjack:node-engines-test sent1nel$ node -v
                  v0.10.29
                  blackjack:node-engines-test sent1nel$ cat package.json
                  {
                    "name": "node-engines-test",
                    "version": "0.0.0",
                    "description": "",
                    "main": "index.js",
                    "scripts": {
                      "test": "echo "Error: no test specified" && exit 1"
                    },
                    "engineStrict": true,
                    "engines": {
                      "node": "v0.11.13"
                    },
                    "start": "node index.js",
                    "author": "",
                    "license": "ISC"
                  }
                  blackjack:node-engines-test sent1nel$ cat index.js
                  console.log('Version: ' + process.version);
                  blackjack:node-engines-test sent1nel$ node index.js
                  Version: v0.10.29
                  blackjack:node-engines-test sent1nel$ npm start
                  blackjack:node-engines-test sent1nel$
                  

                  npm install 似乎也不关心节点引擎版本.

                  npm install doesn't seem to care about the node engine version either.

                  blackjack:node-engines-test sent1nel$ npm install
                  npm WARN package.json node-engines-test@0.0.0 No description
                  npm WARN package.json node-engines-test@0.0.0 No repository field.
                  npm WARN package.json node-engines-test@0.0.0 No README data
                  blackjack:node-engines-test sent1nel$ node -v
                  v0.10.29
                  

                  什么给了?!

                  推荐答案

                  我相信engines 和 engineStrict 用于包被 已安装(通过 npm),而不是在您尝试使用 node.执行 某些东西时.这些选项警告/阻止用户安装不适合(或兼容)他们当前使用的节点版本的包.

                  I believe that the engines and engineStrict are for when the package is being installed (via npm), not when you're trying to execute something with node. These options warn/prevent users from installing a package that is not designed to work (or compatible) with the node version they are currently using.

                  这篇关于如何为项目指定本地版本的 Node?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Node.js/npm - 无论如何判断一个包是否是纯 JS? 下一篇:使用 Javascript 读取环境变量

                  相关文章

                  最新文章

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

                • <tfoot id='vX947'></tfoot>
                  • <bdo id='vX947'></bdo><ul id='vX947'></ul>
                  <legend id='vX947'><style id='vX947'><dir id='vX947'><q id='vX947'></q></dir></style></legend>

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