Less.js: 3.11.0 找不到模块“tslib”

创建于 2020-02-10  ·  19评论  ·  资料来源: less/less.js

找不到模块 'tslib' 3.11.0

high priority

最有用的评论

3.11.0 是一个如此大的更新。
应该是 4.0.0

所有19条评论

我可以承认这个问题。 它提出了最新版本,3.10.3 运行良好。 也许@matthew-dean 可以检查最后一次合并?

使用 docker 重现的步骤

  1. 新建一个文件夹
  2. 在那里放置一些包含有效较少代码的test.less
  3. 创建一个具有以下内容的Dockerfile
FROM buildpack-deps:buster

COPY test.less /

# install npm
ENV HOME /root
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs

# install less and compile something
RUN npm install -g less
WORKDIR /
RUN lessc test.less test.css
  1. 在文件夹中调用docker build .

这将导致以下错误:

Step 6/8 : RUN npm install -g less
 ---> Running in a76855c18efa
/usr/bin/lessc -> /usr/lib/node_modules/less/bin/lessc
+ [email protected]
added 60 packages from 123 contributors in 4.306s
Removing intermediate container a76855c18efa
 ---> b78508030649
Step 7/8 : WORKDIR /
 ---> Running in 6cca70d0d858
Removing intermediate container 6cca70d0d858
 ---> d812408c6ef8
Step 8/8 : RUN lessc test.less test.css
 ---> Running in 6c8ef5fc9408
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'tslib'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/lib/node_modules/less/bin/lessc:9:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
The command '/bin/sh -c lessc test.less test.css' returned a non-zero code: 1

也可以用 grunt-contrib-less ("grunt-contrib-less": "2.0.0") 重现,它使用 "less": "^3.0.4"。
还报告了一个 gulp 问题。

3.11.0 是一个如此大的更新。
应该是 4.0.0

还触发了 Yarn E2E 测试套件上的错误(我们用它来监控各种项目):
https://github.com/yarnpkg/berry/runs/436357016

我怀疑该项目只需要向tslib添加一个依赖项——人们往往会忘记显式列出它,因为源文件不引用它,只有构建工件会引用它。

拍得好,对不起。 该构建正在通过单元测试,所以我猜这里缺少测试。

@siimots

3.11.0 是一个如此大的更新。 应该是 4.0.0

不是真的,就 semver 而言。 不应该有向后不兼容的更改,只是更改一些构建设置。 我很快就会检查出来。

@arcanis

我怀疑该项目只需要向 tslib 添加一个依赖项——人们往往会忘记显式列出它,因为源文件不引用它,只有构建工件会引用它。

发生这种情况的原因可能是因为 tslib 可能是 devDependencies 中的隐式依赖项(依赖项的依赖项)。 所以测试会通过,但正常的npm install不会安装它。

+1,也看到了撇号。 看起来这将很快得到解决,谢谢。

顺便说一句,如果有人知道一种可靠的方法来模拟/测试作为依赖项安装的库并运行测试而无需擦除/重新安装节点模块,我很想听听。

@matthew-dean Fwiw 这类问题是我们在 Yarn 中引入Plug'n'Play的原因之一。 当包进行不安全的访问时(例如这里的tslib ),它会抛出异常,而不是让它们错误地成功。 当然它需要使用 Yarn,因为 npm 不支持它,所以它可能不是你想要的🙂

举个例子,这是我链接的测试报告的内容:

image

有人可以验证此版本是否正在修复问题吗? https://github.com/less/less.js/tree/release-3.11.1

您可以将 node_modules 文件夹嵌套在任何地方。 所以你可以放一个
您的 test/ 文件夹仅用于此目的并且更方便
去炸掉。 我们用撇号来做到这一点。

2020 年 2 月 10 日星期一下午 4:37 Matthew Dean [email protected]
写道:

有人可以验证此版本是否正在修复问题吗?
https://github.com/less/less.js/tree/release-3.11.1


您收到此消息是因为您发表了评论。
直接回复此邮件,在 GitHub 上查看
https://github.com/less/less.js/issues/3469?email_source=notifications&email_token=AAAH27IM5UVBLOEMPE5BJR3RCHCJBA5CNFSM4KSHHJ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELKMI5A#issuecomment-584369268 ,
或退订
https://github.com/notifications/unsubscribe-auth/AAAH27OZWO622K5JYHEYNCLRCHCJBANCNFSM4KSHHJ6Q
.

--

托马斯·布特尔 | 首席技术官
撇号 | 撇号.com | 他/他/他的

在里面你可以有一个符号链接来找到模块​​的主文件夹
正确的名字。

2020 年 2 月 10 日星期一下午 5:02 Tom Boutell [email protected]写道:

您可以将 node_modules 文件夹嵌套在任何地方。 所以你可以放一个
您的 test/ 文件夹仅用于此目的并且更方便
去炸掉。 我们用撇号来做到这一点。

2020 年 2 月 10 日星期一下午 4:37 Matthew Dean [email protected]
写道:

有人可以验证此版本是否正在修复问题吗?
https://github.com/less/less.js/tree/release-3.11.1


您收到此消息是因为您发表了评论。
直接回复此邮件,在 GitHub 上查看
https://github.com/less/less.js/issues/3469?email_source=notifications&email_token=AAAH27IM5UVBLOEMPE5BJR3RCHCJBA5CNFSM4KSHHJ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELKMI5A#issuecomment-584369268 ,
或退订
https://github.com/notifications/unsubscribe-auth/AAAH27OZWO622K5JYHEYNCLRCHCJBANCNFSM4KSHHJ6Q
.

--

托马斯·布特尔 | 首席技术官
撇号 | 撇号.com | 他/他/他的

--

托马斯·布特尔 | 首席技术官
撇号 | 撇号.com | 他/他/他的

@matthew-dean ...我如何更改我的 package.json 文件来试用您的新版本? 如果我不指定版本,我仍然只能下拉 3.11.0。

@botell这不是最清楚的描述。 你的意思是在回购中设置某种子包吗? 我想知道您如何以不会遇到 Node 的父级node_modules解析算法的方式执行此操作。

@jmwolfe

https://docs.npmjs.com/files/package.json#git -urls-as-dependencies

唔。 不,你是对的,这不太适合你的情况。 唯一的
我能想到的肯定是设置一个本地 npm 代理,其中
从您自己的位置满足该特定模块,并测试 npm
安装反对。 像这样的本地 npm 代理其实并不难
来吧,但它有点多。

2020 年 2 月 10 日星期一下午 5:10 Matthew Dean [email protected]
写道:

@boutell https://github.com/boutell这不是最清楚的
描述。 你的意思是在回购中设置某种子包吗?
我想知道您如何以不会遇到 Node 父级的方式执行此操作
node_modules 解析算法。

@jmwolfe https://github.com/jmwolfe

https://docs.npmjs.com/files/package.json#git -urls-as-dependencies


你收到这个是因为你被提到了。
直接回复此邮件,在 GitHub 上查看
https://github.com/less/less.js/issues/3469?email_source=notifications&email_token=AAAH27O3T4O2Z7VPTBA6HYLRCHGEPA5CNFSM4KSHHJ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELKPPYQ#issuecomment-58438243
或退订
https://github.com/notifications/unsubscribe-auth/AAAH27JP6LEUZIENWBEWERLRCHGEPANCNFSM4KSHHJ6Q
.

--

托马斯·布特尔 | 首席技术官
撇号 | 撇号.com | 他/他/他的

@matthew-dean - 在我的 package.json 中使用它来修复依赖于更少的 gulp-less:

"dependencies": {
    "less": "git://github.com/less/less.js.git#afc9b86"
}

# npm list less
[email protected] C:\SVN\CMGR\branches\cmgr_pmm2\ContentManager\ContentManager            
+-- [email protected]                                                                           
| `-- [email protected]  deduped (git://github.com/less/less.js.git#afc9b8606272a01bf4392f71e4d9db59d06fddb9)                                                                                     
`-- [email protected]  (git://github.com/less/less.js.git#afc9b8606272a01bf4392f71e4d9db59d06fddb9)

我生成的 gulpfile.js 完美加载。

附言。 gulp-less 和其他一些包在 devDependencies 中。

太好了谢谢! 这是发布到 npm 的吗?

2020 年 2 月 11 日星期二上午 12:53 Matthew Dean [email protected]
写道:

关闭 #3469 https://github.com/less/less.js/issues/3469通过 842386b
https://github.com/less/less.js/commit/842386b8db5cb5afa4edf5a4c81d40bcbf47a6a2
.


你收到这个是因为你被提到了。
直接回复此邮件,在 GitHub 上查看
https://github.com/less/less.js/issues/3469?email_source=notifications&email_token=AAAH27NPPJXO4IOUM2I2J3LRCI4NLA5CNFSM4KSHHJ62YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWRJHA5I
或退订
https://github.com/notifications/unsubscribe-auth/AAAH27I5LOTWY22VMC57QFLRCI4NLANCNFSM4KSHHJ6Q
.

--

托马斯·布特尔 | 首席技术官
撇号 | 撇号.com | 他/他/他的

@botell是的。 我刚刚验证了。

👍 谢谢你所做的一切!

2020 年 2 月 11 日星期二下午 12:18 Jesse Wolfe [email protected]
写道:

@botell https://github.com/botell是的。 我刚刚验证了。


你收到这个是因为你被提到了。
直接回复此邮件,在 GitHub 上查看
https://github.com/less/less.js/issues/3469?email_source=notifications&email_token=AAAH27P3RR4ZWL6PXZHC7N3RCLMXRA5CNFSM4KSHHJ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELNIUHY#issuecomment-58474755
或退订
https://github.com/notifications/unsubscribe-auth/AAAH27MKPLJTLBZ5NLHZWALRCLMXRANCNFSM4KSHHJ6Q
.

--

托马斯·布特尔 | 首席技术官
撇号 | 撇号.com | 他/他/他的

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

chricken picture chricken  ·  6评论

heavyk picture heavyk  ·  3评论

Oskariok picture Oskariok  ·  6评论

renoth picture renoth  ·  6评论

vecerek picture vecerek  ·  5评论