节点版本真的很重要吗?
@westtrade Milligram已升级到 Node.js 的 LTS 版本,因为强烈推荐保持所有依赖项最新的做法。
请您详细解释一下为什么 Milligram 需要 Node.js v11?
我自己偶然发现了这个问题。 目前在节点 14 上,流血边缘,并使用svelte ,它也处于流血边缘。 作为用户,让一个仅 css 的框架告诉我我应该在哪个节点引擎上有点奇怪。 我认为这个引擎标志对milligram
本身的开发人员更有用吗?
在纱线中解决此问题的一个简单方法是yarn add --ignore-engines milligram
,并告诉任何将您的 repo 克隆到yarn install --frozen-lockfile --ignore-engines
而不仅仅是yarn install --frozen-lockfile
。 但是,这并不理想,因为我导入的只是 css。
@davidroeca是的。 定义 Node.js 版本是因为它是 Milligram 的开发环境所必需的。 此外,高度推荐的做法是保持所有依赖项都是最新的。 在这种情况下,Milligram 使用 Node.js 的 LTS 版本 (v12)。
所以,让我更好地了解正在发生的事情,也许我们可以帮助改进它。
@cjpatoilo我同意最好让软件包保持最新。 我实际上比 v12 更新。 我的问题与@westtrade的问题略有不同,因为我的问题可以通过将引擎插入符要求切换为>=
来解决,以允许未来的节点版本:
"engines": {
- "node": "^12.17.0",
+ "node": ">=12.17.0",
"npm": "^6.14.5"
},
bootstrap repo 中也发生dist/
文件夹。 这发生在构建步骤中,所以我实际上不需要任何与 JS 相关的东西来下载这些文件。
从这个 repo 的开发角度来看,在这方面,自述文件中指定支持的节点版本 + 带有固定节点版本的 CI 环境是否足够?
@westtrade @davidroeca现在,我将从 package.json 中删除engine
@davidroeca @westtrade请告诉我安装
我知道我们有两个很好的例子,据我所知,第一个例子使用 LTS 之前的版本,第二个例子使用 LTS 之后的版本,两个例子都受到影响。
首先,我想知道在使用 Yarn 和 Npm 时是否会发生相同的行为。
此外,当您使用或安装 Milligram v1.4.0 和 v1.3.0(最新版本)时会发生相同的行为吗?
使用 npm,我收到以下警告:
❯ node --version
v14.4.0
❯ npm --version
6.14.5
❯ npm install --save milligram
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.17.0","npm":"^6.14.5"} (current: {"node":"14.4.0","npm":"6.14.5"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
+ [email protected]
added 2 packages from 1 contributor and audited 2 packages in 1.581s
found 0 vulnerabilities
使用纱线,这是一个错误:
❯ node --version
v14.4.0
❯ yarn --version
1.22.4
❯ yarn add milligram
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^12.17.0". Got "14.4.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
下降到12.8.0
❯ node --version
v12.18.0
❯ npm --version
6.14.5
❯ npm install --save milligram
npm notice created a lockfile as package-lock.json. You should commit this file.
+ [email protected]
added 2 packages from 1 contributor and audited 2 packages in 0.876s
found 0 vulnerabilities
用纱线:
❯ yarn --version
1.22.4
❯ yarn add milligram
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
├─ [email protected]
└─ [email protected]
Done in 0.34s.
使用milligram@~1.3.0
,我可以毫无问题地使用最新版本的 nodejs:
❯ node --version
v14.4.0
❯ yarn add milligram@~1.3.0
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
├─ [email protected]
└─ [email protected]
Done in 1.47s.
@davidroeca @westtrade请告诉我安装
我知道我们有两个很好的例子,据我所知,第一个例子使用 LTS 之前的版本,第二个例子使用 LTS 之后的版本,两个例子都受到影响。
首先,我想知道在使用 Yarn 和 Npm 时是否会发生相同的行为。
此外,当您使用或安装 Milligram v1.4.0 和 v1.3.0(最新版本)时会发生相同的行为吗?
就我而言,它根本没有安装,并且 NPM 会抛出我在标题中写的错误。 您的框架很棒 - 但奇怪的是样式框架需要服务器解释器版本。 如果没有服务器解释器,浏览器样式就不能工作吗?
@davidroeca @westtrade感谢您向我解释。
我会继续跟踪这个问题,也许我会找到更好的方法。
现在,我将关闭此问题并合并 PR #253。
请随时重新打开此问题或打开一个新问题。
最有用的评论
就我而言,它根本没有安装,并且 NPM 会抛出我在标题中写的错误。 您的框架很棒 - 但奇怪的是样式框架需要服务器解释器版本。 如果没有服务器解释器,浏览器样式就不能工作吗?