运行yarn install --production
它不会安装所需的依赖项forever
。 这似乎与在devDependencies
具有nodemon
devDependencies
。
错误回应:
> forever app.js
module.js:457
throw err;
^
Error: Cannot find module 'minimatch'
我在这里创建了一个测试应用程序:
https://github.com/donovan-graham/yarn-example-app
# Steps to reproduce error
git clone https://github.com/donovan-graham/yarn-example-app.git
cd yarn-example-app
yarn install --production
npm start
# temporary step to bypass error
rm -rf node_modules
yarn remove nodemon
yarn install --production
npm start
@ Daniel15我猜这是因为nodemon具有minimatch的最新版本。
链接器功能当前将deps和dev deps都纳入其中。 为了产生论据,应避免这种情况。
即使在普通纱线上,也无需生产参数。 实际路径中仅安装了最新版本。 这也必须检查。
运行yarn install --production
然后尝试使用webpack
运行我的构建时,我遇到了类似的问题(运行yarn install
可以正常工作)。
> NODE_ENV=production webpack -p --config webpack/production.config.js
module.js:457
throw err;
^
Error: Cannot find module 'graceful-fs'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
如果我没记错的话,以前的尝试对另一个软件包也显示了类似的错误(不仅是graceful-fs
)
我也变得非常相似... yarn install
很好用。 但是用--production
标志我得到了:
> yarn install --production
yarn install v0.15.1
error npm-shrinkwrap.json found. This will not be updated or respected. See [TODO] for more information.
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] ⠐ node-sass: at Module.require (module.js:367:17)
[-/1] ⠐ waiting...
[-/1] ⠐ waiting...
[-/1] ⠐ waiting...
error C:\vagrant\ebroker-quoteengine\node_modules\node-sass: Command failed.
Exit code: 1
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c node scripts/install.js
Directory: C:\vagrant\ebroker-quoteengine\node_modules\node-sass
Output:
module.js:341
throw err;
^
Error: Cannot find module 'tough-cookie'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\vagrant\ebroker-quoteengine\node_modules\node-sass\node_modules\request\lib\cookies.js:3:13)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at SpawnError (C:\Users\nathan.white\AppData\Roaming\npm\node_modules\yarnpkg\lib\errors.js:18:1)
at ChildProcess.<anonymous> (C:\Users\nathan.white\AppData\Roaming\npm\node_modules\yarnpkg\lib\util\child.js:107:15)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:471:12)
可以通过以下方式重现类似问题:
npm init --yes
yarn add --dev nodemon
yarn add gulp
rm -rf node_modules
yarn install --production
这将安装is-glob
但不会安装其依赖项is-extglob
:
> yarn why is-glob
yarn why v0.16.0
# ...
info Reasons this module exists
- "nodemon#chokidar" depends on it
- "gulp#liftoff#findup-sync" depends on it
> yarn why is-extglob
yarn why v0.16.0
# ...
info This module exists because "nodemon#chokidar#is-glob" depends on it.
遍历时似乎“忘记”了gulp#liftoff
依赖路径。
编辑:较小的示例:
npm init --yes
yarn add --dev [email protected]
yarn add [email protected]
rm -rf node_modules
yarn --prod
node -e "require('is-glob')"
还确认在运行yarn --prod
之前删除devDependencies
yarn --prod
会安装正确的依赖关系树。
我的软件团队遇到了这个问题,特别是软件包prr
,它是less
和pouchdb
的依赖项。 --production
构建中也缺少许多其他软件包,但是prr
是第一个导致我们的产品失败的软件包。 这个问题对我们来说是一个难题,因为如果包含dev软件包,安装程序的大小会大大增加,所以我们返回了使用npm。
FWIW:我可以通过在生产中运行yarn
之前从package.json中删除devDependencies
部分来解决此问题。
正如@gihrig所说,运行npm prune --production
可以删除devDependencies,这有助于解决此问题。
正如@gihrig所说,运行npm prune --production可以删除devDependencies,有助于解决此问题。
与npm相比,Yarn的主要优势是确定性的node_modules
目录,即,开箱即用的dev,CI和生产相同。 运行npm prune --production
产生相同的行为?
我当前的解决方法是仅在生产环境中安装devDependencies
。 磁盘价格便宜(尤其是在AWS上),确定性安装对我来说比磁盘空间重要得多。 因此,我的“解决方法”是让yarn --production
现在不存在。
@tanx npm prune --production
只需删除devDependencies。 在我的测试中,总是删除相同的模块。 另一方面,是的,磁盘空间很便宜,所以也许好像yarn --production
不退出是一个更好的解决方法:)
@tanx npm prune --production只删除devDependencies。 在我的测试中,总是删除相同的模块。
这恰恰是Yarn博客文章中描述的“在我的机器上工作”的心态。 问题是您让npm通过yarn.lock
文件更改了node_modules
而没有纱线的完整性检查。
希望通过更新纱线以尊重开发人员与生产部门的关系,很快就可以解决所讨论的变通办法。 同时,“ npm prune”后处理黑客确实有很多值得抱怨的地方。
上面描述的yarn why
事物是无关的。 它似乎只是why
代码如何搜索软件包的副作用。
试图找到一种不错的方式来执行此操作,而无需增加额外的遍历来传播图形一次后的可见性。 不知道将可见性分为一个单独的步骤是否可以接受。
还有一些有趣的极端情况,这不仅仅在于正确解决可见性:
在这种情况下,C的可选标志取决于dev与prod。 在开发中,它将是非可选的,在生产中,它将是可选的。 仅从父母之一继承可选标记(或始终从生产父母继承它)可能会导致异常。
在0.17.2中仍未解决此问题
复制: https :
yarn
node index.js # works
yarn --prod
node index.js # explodes
/ cc @jkrems
在0.17.2(HearthSim / Joust#169)中,对我来说似乎也不固定。
我将重新打开它,因为可以使用@SimenB的说明轻松复制它。
@wyze问题可能出在安装本身,而不是修剪?
rm -rf node_modules/ && yarn && npm prune --production && node index.js
失败,出现相同错误。
rm -rf node_modules/ && npm i && npm prune --production && node index.js
虽然可以。
我猜yarn和npm并不是要同时使用,因此可能会产生相同的错误,这是一个巧合。
版本比较node_modules
后npm i
和yarn
显示,纱不输出"_requiredBy"
,大概就是为什么npm prune
起来后食堂一yarn install
。 该信息可在锁文件中找到,所以应该不成问题,对吗?
同样的问题,我们正在docker上测试生产环境,发现即使安装了父模块send
(由express使用),也缺少yarn --production
软件包mime
。
我认为应该优先处理此问题,因为这会导致无法预测的构建。
作为一种解决方法,我只是在构建脚本中从package.json中删除devDependencies部分。
$ jq 'del(.devDependencies)' package.json > tmp.json && mv tmp.json package.json
遵循@ dy-dx的建议,我为Docker编写了一个自定义入口点,以在开发过程中对此问题进行修补:
首先,您应该在Dockerfile中安装jq,并在以下位置添加以下行:
RUN apt-get update && \
apt-get install -y jq
然后将此脚本添加到某处并将其用作Dockerfile [ENTRYPOINT]
或docker-compose entrypoint
entrypoint.sh
使用您的首选命令来Dockerfile [CMD]
或docker-compose command
例如npm start
可以在CI中使用相同的脚本并进行一些编辑以构建图像
@SimenB您可以从entries-test
软件包中删除node_modules
并尝试吗?
解压v1.0.1 tar球,这里有一个node_modules
文件夹,其中包含define-properties
和其他模块。 而且,它们都没有任何*.js
文件。
@torifat Huh,那是怎么做到的? 不使用bundledDependencies
就不可能包含node_modules
bundledDependencies
...
将尝试推送一个干净的文件(我已经删除了项目,将不得不重新创建)。
@torifat看起来是毛线的错。
$ mkdir some-dir && cd some-dir && yarn init -y && yarn add object.entries && yarn pack && tar -ztvf some-dir-v1.0.0.tgz
drwxr-xr-x 0 0 0 0 Nov 27 10:36 package
-rw-r--r-- 0 0 0 972 Oct 15 2015 package/node_modules/define-properties/CHANGELOG.md
-rw-r--r-- 0 0 0 1080 Oct 15 2015 package/node_modules/define-properties/LICENSE
-rw-r--r-- 0 0 0 2725 Oct 15 2015 package/node_modules/define-properties/README.md
-rw-r--r-- 0 0 0 1593 Oct 15 2015 package/node_modules/define-properties/package.json
-rw-r--r-- 0 0 0 3798 Aug 21 11:09 package/node_modules/es-abstract/CHANGELOG.md
-rw-r--r-- 0 0 0 1080 Jul 29 2015 package/node_modules/es-abstract/LICENSE
-rw-r--r-- 0 0 0 1812 Aug 13 2015 package/node_modules/es-abstract/README.md
-rw-r--r-- 0 0 0 1989 Aug 21 11:09 package/node_modules/es-abstract/package.json
-rw-r--r-- 0 0 0 1207 Jan 4 2016 package/node_modules/es-to-primitive/CHANGELOG.md
-rw-r--r-- 0 0 0 1082 Nov 1 2015 package/node_modules/es-to-primitive/LICENSE
-rw-r--r-- 0 0 0 2180 Nov 1 2015 package/node_modules/es-to-primitive/README.md
-rw-r--r-- 0 0 0 1558 Jan 4 2016 package/node_modules/es-to-primitive/package.json
-rw-r--r-- 0 0 0 1074 Sep 22 2014 package/node_modules/foreach/LICENSE
-rw-r--r-- 0 0 0 593 Sep 22 2014 package/node_modules/foreach/Readme.md
-rw-r--r-- 0 0 0 1297 Sep 22 2014 package/node_modules/foreach/package.json
-rw-r--r-- 0 0 0 1052 Feb 14 2016 package/node_modules/function-bind/LICENSE
-rw-r--r-- 0 0 0 1488 Feb 14 2016 package/node_modules/function-bind/README.md
-rw-r--r-- 0 0 0 1619 Feb 14 2016 package/node_modules/function-bind/package.json
-rw-r--r-- 0 0 0 1060 Jul 24 2015 package/node_modules/has/LICENSE-MIT
-rw-r--r-- 0 0 0 239 Jul 24 2015 package/node_modules/has/README.mkd
-rw-r--r-- 0 0 0 782 Jul 24 2015 package/node_modules/has/package.json
-rw-r--r-- 0 0 0 1839 Feb 28 2016 package/node_modules/is-callable/CHANGELOG.md
-rw-r--r-- 0 0 0 1082 May 19 2015 package/node_modules/is-callable/LICENSE
-rw-r--r-- 0 0 0 1978 Aug 12 2015 package/node_modules/is-callable/README.md
-rw-r--r-- 0 0 0 1983 Feb 28 2016 package/node_modules/is-callable/package.json
-rw-r--r-- 0 0 0 421 Sep 27 2015 package/node_modules/is-date-object/CHANGELOG.md
-rw-r--r-- 0 0 0 1082 Mar 13 2015 package/node_modules/is-date-object/LICENSE
-rw-r--r-- 0 0 0 1751 Aug 12 2015 package/node_modules/is-date-object/README.md
-rw-r--r-- 0 0 0 1420 Sep 27 2015 package/node_modules/is-date-object/package.json
-rw-r--r-- 0 0 0 482 Jan 30 2015 package/node_modules/is-regex/CHANGELOG.md
-rw-r--r-- 0 0 0 1081 Jan 15 2014 package/node_modules/is-regex/LICENSE
-rw-r--r-- 0 0 0 1623 Jan 28 2015 package/node_modules/is-regex/README.md
-rw-r--r-- 0 0 0 1512 Jan 30 2015 package/node_modules/is-regex/package.json
-rw-r--r-- 0 0 0 121 Jan 26 2015 package/node_modules/is-symbol/CHANGELOG.md
-rw-r--r-- 0 0 0 1082 Jan 24 2015 package/node_modules/is-symbol/LICENSE
-rw-r--r-- 0 0 0 1469 Jan 24 2015 package/node_modules/is-symbol/README.md
-rw-r--r-- 0 0 0 1214 Jan 26 2015 package/node_modules/is-symbol/package.json
-rw-r--r-- 0 0 0 6992 Jul 5 19:14 package/node_modules/object-keys/CHANGELOG.md
-rw-r--r-- 0 0 0 1080 Oct 15 2015 package/node_modules/object-keys/LICENSE
-rw-r--r-- 0 0 0 2460 Oct 15 2015 package/node_modules/object-keys/README.md
-rw-r--r-- 0 0 0 1955 Jul 5 19:14 package/node_modules/object-keys/package.json
-rw-r--r-- 0 0 0 560 Oct 6 2015 package/node_modules/object.entries/CHANGELOG.md
-rw-r--r-- 0 0 0 1082 Sep 2 2015 package/node_modules/object.entries/LICENSE
-rw-r--r-- 0 0 0 2339 Sep 2 2015 package/node_modules/object.entries/README.md
-rw-r--r-- 0 0 0 1636 Oct 6 2015 package/node_modules/object.entries/package.json
-rw-r--r-- 0 0 0 145 Nov 27 10:36 package/package.json
使用npm pack
可以按预期方式工作(在同一目录中)。
$ npm pack && tar -ztvf some-dir-1.0.0.tgz
-rw-r--r-- 0 501 20 145 Nov 27 10:36 package/package.json
-rw-r--r-- 0 501 20 2460 Nov 27 10:36 package/yarn.lock
好像Yarn是如此地讨厌将changelog
, readme
和package.json
包括在内,甚至包括node_modules
...
@torifat现在已发布1.0.2(使用npm以避免刚才提到的错误),仍然是相同的问题
针对node_modules的错误开放了#2047的功能,但是在这个问题上这是一个红色的鲱鱼,因为我的repro在发布了适当的tarball之后仍然有效。
(对订阅者的垃圾邮件很抱歉,我现在停止)
@SimenB谢谢您的时间。 我发现了这个错误。
这似乎与我刚打开的#2104有关。 安装OP后的node_modules/.bin
:
$ ll node_modules/.bin
total 16
lrwxr-xr-x 1 samuelreed staff 22B Dec 1 11:16 forever -> ../forever/bin/forever
lrwxr-xr-x 1 samuelreed staff 109B Dec 1 11:16 nodemon -> ../../../../../Library/Caches/Yarn/npm-nodemon-1.11.0-226c562bd2a7b13d3d7518b49ad4828a3623d06c/bin/nodemon.js
已通过#2116修复。
#2116是否已合并? 我在提交历史中看不到它。 如果没有标记的发行版,至少在master上没有可用的修补程序,似乎还为时过早,无法解决一堆问题。 同样,看起来#2116未能通过所有三个检查。 我想念什么吗?
v0.18.0中仍然存在此问题,其中包括(#2116)。
是的,我可以确认此问题仍存在于0.18.0中
从我看到的#2116应该已经针对此问题引入了测试( test.concurrent('-production标志会忽略开发人员的依赖关系'...或者我错了吗?
该测试未验证传递依赖项的正确行为:
就我而言,问题是prod(minimatch v2.0.0)和dev(useragent v2.1.9)依赖之间的共享依赖(lru缓存)。 即使prod依赖项需要,该共享依赖项也未安装在--production
。
@beheh我没看到minimatch
使用lru-cache
,也许这就是为什么不在生产中安装的原因?
dep { A->B }
devDep { B }
OK
A,B are installed.
dep { A->C->D }
devDep { B->C->D }
OK
A,C,D are installed.
dep { E->A->C->D }
devDep { B->C->D }
KO
E,A,C are installed but D is missing.
@SimenB就是这种情况
"dependencies": {
"entries-test": "^1.0.1"
},
"devDependencies": {
"object.values": "^1.0.3"
}
@SharpEdgeMarshall感谢您的测试。 我将其添加为测试用例。
@torifat也可以考虑重新打开它
@SharpEdgeMarshall尝试以下操作,并且可以正常工作。 需要弄清楚实际问题。
@SimenB需要在重新打开之前进行验证。 optionalDependencies
也可能会发生这种情况。 这还有另一个未解决的问题。
@torifat我的https :
编辑:没有可选的部门, grep optional yarn.lock
退出1
现在,它在Error: Cannot find module 'object-keys'
上失败,而不是丢失define-properties
。
$ yarn why object-keys
yarn why v0.18.0
[1/4] 🤔 Why do we have the module "object-keys"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
info This module exists because "object.values#define-properties" depends on it.
✨ Done in 0.09s.
似乎现在可以更深入地处理一个级别,但是随后失败了
@SimenB刚刚尝试使用您的:
{
"dependencies": {
"entries-test": "^1.0.1"
},
"devDependencies": {
"object.values": "^1.0.3"
}
}
而且,对我来说很好。 您可以做yarn cache clean
再试一次吗?
不,失败
@SimenB您可以共享yarn.lock
文件吗?
$ rm -rf node_modules && rm yarn.lock && yarn cache clean && yarn && node index.js && yarn --prod && node index.js
yarn cache v0.18.0
success Cleared cache.
✨ Done in 0.07s.
yarn install v0.18.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
✨ Done in 0.92s.
yarn install v0.18.0
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
✨ Done in 0.18s.
module.js:471
throw err;
^
Error: Cannot find module 'object-keys'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/simbekkh/repos/ugh/node_modules/define-properties/index.js:3:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
对我来说,即使在yarn cache clean
之后,SimenB的示例也无法在0.18.0下运行
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
define-properties@^1.1.2:
version "1.1.2"
resolved "http://npm.office.crweb.it/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
entries-test@^1.0.1:
version "1.0.2"
resolved "http://npm.office.crweb.it/entries-test/-/entries-test-1.0.2.tgz#f1039aba3a2effc9c3a56b6b1180694b2789e4d5"
dependencies:
object.entries "^1.0.3"
es-abstract@^1.6.1:
version "1.6.1"
resolved "http://npm.office.crweb.it/es-abstract/-/es-abstract-1.6.1.tgz#bb8a2064120abcf928a086ea3d9043114285ec99"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.0"
is-callable "^1.1.3"
is-regex "^1.0.3"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "http://npm.office.crweb.it/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
foreach@^2.0.5:
version "2.0.5"
resolved "http://npm.office.crweb.it/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
function-bind@^1.0.2, function-bind@^1.1.0:
version "1.1.0"
resolved "http://npm.office.crweb.it/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
has@^1.0.1:
version "1.0.1"
resolved "http://npm.office.crweb.it/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
function-bind "^1.0.2"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "http://npm.office.crweb.it/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-date-object@^1.0.1:
version "1.0.1"
resolved "http://npm.office.crweb.it/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-regex@^1.0.3:
version "1.0.3"
resolved "http://npm.office.crweb.it/is-regex/-/is-regex-1.0.3.tgz#0d55182bddf9f2fde278220aec3a75642c908637"
is-symbol@^1.0.1:
version "1.0.1"
resolved "http://npm.office.crweb.it/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
object-keys@^1.0.8:
version "1.0.11"
resolved "http://npm.office.crweb.it/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.entries@^1.0.3:
version "1.0.4"
resolved "http://npm.office.crweb.it/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.6.1"
function-bind "^1.1.0"
has "^1.0.1"
object.values@^1.0.3:
version "1.0.4"
resolved "http://npm.office.crweb.it/object.values/-/object.values-1.0.4.tgz#e524da09b4f66ff05df457546ec72ac99f13069a"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.6.1"
function-bind "^1.1.0"
has "^1.0.1"
$ rm -rf node_modules && rm yarn.lock && yarn cache clean && yarn && node index.js && rm -rf node_modules && rm yarn.lock && yarn cache clean && yarn --prod && node index.js
yarn cache v0.18.0
success Cleared cache.
✨ Done in 0.07s.
yarn install v0.18.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
✨ Done in 0.93s.
yarn cache v0.18.0
success Cleared cache.
✨ Done in 0.07s.
yarn install v0.18.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
✨ Done in 0.76s.
module.js:471
throw err;
^
Error: Cannot find module 'object-keys'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/simbekkh/repos/ugh/node_modules/define-properties/index.js:3:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
锁定文件:
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
entries-test@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/entries-test/-/entries-test-1.0.2.tgz#f1039aba3a2effc9c3a56b6b1180694b2789e4d5"
dependencies:
object.entries "^1.0.3"
es-abstract@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.6.1.tgz#bb8a2064120abcf928a086ea3d9043114285ec99"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.0"
is-callable "^1.1.3"
is-regex "^1.0.3"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
foreach@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
function-bind@^1.0.2, function-bind@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
has@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
function-bind "^1.0.2"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-regex@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.3.tgz#0d55182bddf9f2fde278220aec3a75642c908637"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.entries@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.6.1"
function-bind "^1.1.0"
has "^1.0.1"
object.values@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.0.4.tgz#e524da09b4f66ff05df457546ec72ac99f13069a"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.6.1"
function-bind "^1.1.0"
has "^1.0.1"
@SimenB谢谢。 看来,我的缓存出现了问题。 现在清除我的缓存后,它失败了。 但是,有一个不同的错误。 给我一些时间进行调查。
@SimenB在v0.18.0
失败,但无法在最新的master
重现。
更新:很奇怪! 再次失败😕
@torifat我可以确认这不适用于master(v0.19.0)
rm -rf node_modules && rm yarn.lock && ../yarn/bin/yarn cache clean && ../yarn/bin/yarn && node index.js && rm -rf node_modules && rm yarn.lock && ../yarn/bin/yarn cache clean && ../yarn/bin/yarn --prod && node index.js
yarn cache v0.19.0-0
success Cleared cache.
Done in 0.58s.
yarn install v0.19.0-0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 10.18s.
yarn cache v0.19.0-0
success Cleared cache.
Done in 0.09s.
yarn install v0.19.0-0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 4.26s.
module.js:457
throw err;
^
Error: Cannot find module 'object-keys'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/sharpedge/git/Utility/YarnBug/node_modules/define-properties/index.js:3:12)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
我在使用当前稳定的0.17.10
遇到相同的问题(某些软件包未安装--production
标志):
curl -o- -L https://yarnpkg.com/install.sh | bash && ~/.yarn/bin/yarn install --production && rm -rf ~/.yarn
但是,当我尝试使用当前的每晚版本Yarn 0.19.0-20161207.1241
,为我的应用正确安装
wget https://yarnpkg.com/install.sh && chmod +x install.sh && ./install.sh --nightly && rm -f install.sh && ~/.yarn/bin/yarn install --production && rm -rf ~/.yarn
@SharpEdgeMarshall @SimenB您能否尝试最新的每晚构建并确认问题仍然存在。
在我的Docker容器中使用: https :
@nodkz 18稳定了(我认为吗?),但是正好在您上方的帖子中可以看到,大师(至少在2天前)仍然存在该错误。
我认为仍然需要install yarn@rc
:
'dist-tags': { rc: '0.18.0', latest: '0.17.10' },
那是新的,几天前我通过安装获得了0.18。 无论如何,该错误仍可在0.18中重现。
@nodkz Repro是:
{
"dependencies": {
"entries-test": "^1.0.1"
},
"devDependencies": {
"object.values": "^1.0.3"
}
}
是的,我们的项目也遇到类似的问题:
rm -rf package.json yarn.lock node_modules && npm init --yes && yarn add --dev nodemon && yarn add glob-stream && yarn --prod && node -p "require('glob-stream')"
0.18和最新的master分支均失败。
同意仍然能够以最新版本进行复制。
我认为我的问题与此相似。 在Heroku上构建失败,但仅适用于生产环境。 缓存被禁用。
Resolving node version ^7.2.1 via semver.io...
Downloading and installing node 7.2.1...
Using default npm version: 3.10.10
Resolving yarn version (latest) via semver.io...
Downloading and installing yarn (0.18.1)...
Installed yarn 0.18.1
-----> Restoring cache
Skipping cache restore (disabled by config)
-----> Building dependencies
Installing node modules (yarn)
yarn install v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /tmp/build_0e4ff736ad0f25dc816a47543687fefc/bbb7b6e751dde291f65dea175f41a26862eef28f/node_modules/bcrypt: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-pre-gyp install --fallback-to-build
Directory: /tmp/build_0e4ff736ad0f25dc816a47543687fefc/bbb7b6e751dde291f65dea175f41a26862eef28f/node_modules/bcrypt
Output:
module.js:472
throw err;
^
Error: Cannot find module 'abbrev'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/tmp/build_0e4ff736ad0f25dc816a47543687fefc/bbb7b6e751dde291f65dea175f41a26862eef28f/node_modules/nopt/lib/nopt.js:10:14)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed
我也有这个问题。 由于yarn install --production
不能正确安装正确的依赖项,因此到目前为止,我仍在使用yarn install
进行生产。
恐怕我做不到,因为它在我认为的Heroku buildpack中被硬编码为yarn install --production
(参考https://github.com/heroku/heroku-buildpack-nodejs/issues/337)
@adamreisnz对不起,我指的不是您的原始问题。
要解决此问题,建议您暂时将所有devDependencies
放入dependencies
,直到解决此问题为止。
@dashmug嗯,没问题。
无论如何,我宁愿现在在Heroku上使用npm
直到Yarn变得更稳定为止,而不是四处乱码。 我已将yarn.lock
放入我的.gitignore
因此它不会上传到仓库/ heroku。 这样,我仍然可以在本地使用Yarn,但不会影响Heroku上的构建。
@adamreisnz这打败了您使用yarn
,不是吗?
@dashmug至少对我们而言,不是真的,至少不是。 我没有将其用于锁定软件包版本。 我们具有最新的依赖关系,并且“在我的计算机上工作”没有问题。 我通过npm迁移到yarn的主要原因是速度,对于具有很多依赖项的复杂应用程序,我看到它从5分钟的npm install
变为22秒的yarn。
只要纱线不稳定,只要我可以在本地使用纱线进行开发并快速安装,我就可以在Heroku上使用稍微慢一点的构建过程。
广告中称纱线几乎是npm的替代品。 但是,像这样的问题,我们遇到的一些尚未解决的问题使我们无法原样使用它。 因此,我目前将其视为一种额外的工具,它对一件事有用,但对另一件事却没有。 我毫不怀疑时间会很好:)
这对于我来说在0.18.1中是固定的。
Heroku失败时使用的是0.18.1,因此尚未修复。
我已在0.18.1上修复此问题。
我之前的repro固定为0.18.1🎉
我明天会用一个真正的应用程序尝试
0.18.1解决了我的问题。 我是一个快乐的露营者
在先前失败的非平凡应用程序中尝试了0.18.1,现在看来可以正常工作! 🎉
我想我会再给它一次:)
抱歉,仍然无法使用0.18.1;
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): ^7.2.1
engines.npm (package.json): unspecified (use default)
Resolving node version ^7.2.1 via semver.io...
Downloading and installing node 7.2.1...
Using default npm version: 3.10.10
Resolving yarn version (latest) via semver.io...
Downloading and installing yarn (0.18.1)...
Installed yarn 0.18.1
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (yarn)
yarn install v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /tmp/build_c86802dccae94b3fb074d3b88f3f63f2/9512deeed23c0eca48d68fb2c8850a28f76692ea/node_modules/bcrypt: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-pre-gyp install --fallback-to-build
Directory: /tmp/build_c86802dccae94b3fb074d3b88f3f63f2/9512deeed23c0eca48d68fb2c8850a28f76692ea/node_modules/bcrypt
Output:
module.js:472
throw err;
^
Error: Cannot find module 'abbrev'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/tmp/build_c86802dccae94b3fb074d3b88f3f63f2/9512deeed23c0eca48d68fb2c8850a28f76692ea/node_modules/nopt/lib/nopt.js:10:14)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- A module may be missing from 'dependencies' in package.json
https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
- This module may be specified in 'devDependencies' instead of 'dependencies'
https://devcenter.heroku.com/articles/nodejs-support#devdependencies
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
设置NODE_MODULES_CACHE=false
也无济于事。
这是依赖关系树:
├─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └─┬ @google-cloud/[email protected]
│ └─┬ @google-cloud/[email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
└── [email protected]
我认为问题在于通过google-cloud
的深度依赖。 那是一个生产模块, bable-cli
和instanbul
都是开发人员。
此外,当我使用yarn why abbrev
,它无法拾取google-cloud
和babel-cli
父母家属:
yarn why v0.18.1
[1/4] 🤔 Why do we have the module "abbrev"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
info Reasons this module exists
- "istanbul" depends on it
- "istanbul#nopt" depends on it
@jkrems和@SimenB我可以
istanbul#nopt
why
输出中的istanbul#nopt
看起来也不对。
我现在无法正常工作,将在真实的应用中进行测试
@SimenB谢谢,让我知道您是否需要更多信息,例如我的整个package.json模块列表。
编辑:实际上,这是为了以防万一,因为我现在要睡觉;
"dependencies": {
"bcrypt": "^1.0.1",
"bluebird": "^3.4.6",
"body-parser": "^1.15.2",
"chalk": "^1.1.3",
"compression": "^1.6.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.1",
"express": "^4.14.0",
"glob": "^7.1.1",
"google-cloud": "^0.45.1",
"handlebars": "^4.0.6",
"html-pdf": "^2.1.0",
"http-as-promised": "^1.1.0",
"meanie-express-error-handling": "git+https://github.com/meanie/express-error-handling#2.0.0",
"meanie-express-github-service": "^2.0.2",
"meanie-express-jwt-service": "^1.0.2",
"meanie-express-raven-service": "^1.0.1",
"meanie-mail-composer": "^1.2.0",
"meanie-mongoose-only-id": "^1.0.1",
"meanie-mongoose-set-properties": "^1.0.1",
"meanie-mongoose-to-json": "^1.1.0",
"meanie-multer-mime-types-filter": "^1.0.1",
"meanie-passport-refresh-strategy": "^1.1.2",
"moment": "^2.17.1",
"mongoose": "^4.7.3",
"morgan": "^1.7.0",
"multer": "^1.1.0",
"passport": "^0.3.2",
"passport-http-bearer": "^1.0.1",
"passport-local": "^1.0.0",
"phantomjs-prebuilt": "2.1.14",
"sendgrid": "^4.7.1",
"sendgrid-mailer": "^1.0.7",
"socket.io": "^1.7.2",
"yargs": "^6.5.0"
},
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"dirty-chai": "^1.2.2",
"eslint": "^3.12.1",
"express-simulate-latency": "0.0.2",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^3.2.0",
"mocha-clean": "^1.0.0",
"nodemon": "^1.11.0",
"sinon": "^1.17.6",
"sinon-as-promised": "^4.0.0",
"sinon-mongoose": "^1.3.0"
}
对于工作中的应用程序,这仍然失败。 似乎Yarn无法走深路。 yarn --prod
之后是npm ls entities
yarn --prod
$ npm ls entities
[email protected] /Users/simbekkh/repos/frontpage
└─┬ @finn-no/[email protected]
└─┬ [email protected]
└─┬ [email protected]
└─┬ [email protected]
└─┬ [email protected]
└─┬ [email protected]
└── UNMET DEPENDENCY entities@~1.1.1
npm ERR! missing: entities@~1.1.1, required by [email protected]
与@adamreisnz一样, yarn why
不能选择正确的树。
$ yarn why entities
yarn why v0.18.1
[1/4] 🤔 Why do we have the module "entities"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
info Reasons this module exists
- "cheerio" depends on it
- "cheerio#htmlparser2" depends on it
info Disk size without dependencies: "108kB"
info Disk size with unique dependencies: "108kB"
info Disk size with transitive dependencies: "108kB"
info Amount of shared dependencies: 0
✨ Done in 0.40s.
istanbul#nopt在为什么输出中也看起来不对。
没错,这似乎可能是此问题的核心。 似乎认为nopt
是istanbul
软件包的一部分,而不是google-cloud
和/或babel-cli
,这也许就是为什么它没有为生产安装它的原因环境,因为istanbul
不是prod依赖项。
嘿,大家,很抱歉您已经有一段时间了。
我将把这个问题分配给我自己,现在这是当务之急,我将在假期期间尝试解决此问题。
非常欢迎使用隔离测试或修复(理想情况下)的帮助和PR。
我们在prod env中有一个与lib bl
相同的问题,它是gulp-imagemin
的可选依赖项的依赖项😕
[~/Workspaces/my-project 12:05:33] NODE_ENV=production yarn
yarn install v0.18.1
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning algoliasearch > [email protected]: Just use Array.isArray directly
warning gulp-file > through2 > xtend > [email protected]:
warning raven > [email protected]: use uuid module instead
warning wiredep > bower-config > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning chromedriver > [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
warning mversion > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning wiredep > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning webdriverio > request > [email protected]: use uuid module instead
warning gulp > vinyl-fs > glob-watcher > gaze > globule > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning sprity-lwip > lwip > decree > [email protected]: This package is discontinued. Use lodash@^4.0.0.
[2/4] 🚚 Fetching packages...
warning [email protected]: The engine "ender" appears to be invalid.
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
[1/7] ⠂ fsevents: GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.15/fse-v1.0.15-node-v51-darwi
[2/7] ⠂ gifsicle
[3/7] ⠂ jpegtran-bin
[4/7] ⠂ optipng-bin
error /Users/fdubost/Workspaces/my-project/node_modules/gifsicle: Command failed.
Exit code: 1
Command: sh
Arguments: -c node lib/install.js
Directory: /Users/fdubost/Workspaces/my-project/node_modules/gifsicle
Output:
module.js:474
throw err;
^
Error: Cannot find module 'bl'
at Function.Module._resolveFilename (module.js:472:15)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/fdubost/Workspaces/my-project/node_modules/tar-stream/extract.js:2:10)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
谢谢你的帮助😊
如果我手动将bl
到我们的package.json中,它将起作用。
有什么消息吗?
到目前为止,我正在构建一个临时的commonJS检查器,该检查器独立于Yarn的提升和解析算法https://github.com/yarnpkg/yarn/pull/2419来验证node_modules结构
它将能够捕获此bug中描述的所有情况,并保护我们免受将来的回归。
@kittens正在查看这里发生的情况。
该错误并非微不足道,因此欢迎您提供任何其他见解
好的,现在用最新的行李箱收集所有的代表。
第一条评论中的示例不再复制,并且yarn check --verify-tree
通过
这个也不会复制https://github.com/yarnpkg/yarn/issues/761#issuecomment -260975012和https://github.com/yarnpkg/yarn/issues/761#issuecomment -265823529
是的,那个再现值固定为0.18.1。
2个想法:
我可以与您分享一些解决方案的日志吗?
此外,我可以给您提供在工作中可以重现该文件的锁文件,但是由于私人部门的原因,您将无法安装它。 您可能会四处走动,并跳过获取软件包的过程,而只是对树进行混乱?
@SimenB ,因此您还有另一个示例,其中--production安装的分辨率被破坏了吗?
对于这种情况,您可以尝试:
yarn install --production --verbose
yarn check --production --verify-tree
拥有最新的大师分支。
如果您不想公开发送日志,请通过[email protected]给我
是的,0.18.1仍然被破坏,还没有测试0.19(或主版本)。 如果仍然可以复制(希望不!),我将私下发送日志给您
让我们关闭此任务,因为标题问题已解决。
我还没有再检查2个未解决的问题:#2263和#2141可以在此处发表评论或为您的案例创建一个新的副本,并抄送我。
2all:当您评论安装不正确时,请包含package.json,以便其他人可以复制它。
感谢@jkrems进一步采取措施并提交了出色的repro脚本: https :
@bestander您还重新检查了https://github.com/yarnpkg/yarn/issues/761#issuecomment -268130124吗?
@adamreisnz ,您可以再次共享package.json吗?
https://github.com/yarnpkg/yarn/issues/761#issuecomment -268130124是一个不同的问题。
那个为yarn install --production
失败。
此问题是关于yarn install --production
成功完成,但没有做正确的事。
@bestander我在下面的评论中分享了它, https: //github.com/yarnpkg/yarn/issues/761#issuecomment -268201708,干杯
对于我来说仍然无法使用master(c98df16b)...
yarn check --verify-tree
抛出,这很有希望。 其中很多都是开发部门。
yarn check v0.20.0-0
error "babel-preset-es2015" not installed
error "browserify-middleware" not installed
error "cheerio" not installed
error "codeceptjs" not installed
error "del-cli" not installed
error "eslint" not installed
error "eslint-config-finn" not installed
error "espower-loader" not installed
error "hashmark" not installed
error "interfake" not installed
error "nightmare" not installed
error "nightmare-upload" not installed
error "nock" not installed
error "nodemon" not installed
error "nyc" not installed
error "power-assert" not installed
error "sinon" not installed
error "supertest" not installed
error "uglifyify" not installed
error "@finn-no/express-base#nunjucks#chokidar#anymatch" not installed
error "@finn-no/express-base#unleash-client#request#json-stringify-safe" not installed
error "@finn-no/express-base#pretty-error#renderkid#css-select#domutils#dom-serializer#entities" not installed
error Found 22 errors.
运行该应用程序,它将在缺少任何匹配项时失败。
npm ls
显示其他缺少的部门,这更有意义
npm ERR! extraneous: [email protected] /Users/simbekkh/repos/frontpage/node_modules/node-pre-gyp
npm ERR! missing: anymatch@^1.3.0, required by [email protected]
npm ERR! missing: entities@~1.1.1, required by [email protected]
npm ERR! missing: json-stringify-safe@~5.0.1, required by [email protected]
这是对该问题的观察/原因: https :
没错,这似乎可能是此问题的核心。 似乎认为nopt是istanbul软件包的一部分,而不是google-cloud和/或babel-cli,这也许就是为什么它不将其安装在生产环境中的原因,因为istanbul不是产品的依赖项。
哦,对不起, @ SimenB
yarn check --prodution --verify-tree
我将编辑我的评论
进行yarn check --verify-tree --production
得到不错的输出(它与npm ls
):
yarn check v0.20.0-0
error "@finn-no/express-base#nunjucks#chokidar#anymatch" not installed
error "@finn-no/express-base#unleash-client#request#json-stringify-safe" not installed
error "@finn-no/express-base#pretty-error#renderkid#css-select#domutils#dom-serializer#entities" not installed
error Found 3 errors.
@bestander,我将通过电子邮件将package.json,yarn.lock和详细的安装日志发送给您
@dashmug您是否要我为该问题创建新票证? 这仍然是安装不正确的依赖项的问题(尽管只是为了生产),所以我认为这与该票证有关。
@bestander电子邮件已发送。
虽然@finn-no/express-base
不是公开可用的,但输出中的其他3个包是可用的,因此希望您可以仅使用公共包来复制。
我应该打开一个新期刊吗?
@adamreisnz ,您
我可以复制它,但这与标题不同
这是相关的。 可能是相同的原因。 只是一种不同的症状。 我将其作为一个不同的问题,因为它与标题所说的不完全相同。
@SimenB ,谢谢,我来看一下
好的,伙计们。
@bestander仅在输出失败的情况下制作这3个程序包,这使我可以使用公共部门在master上重现该程序包。 这不是最小的复制,但仍然
{
"name": "app",
"version": "1.0.0",
"dependencies": {
"brakes": "^2.5.1",
"compression": "^1.6.2",
"envalid": "^2.4.0",
"express": "^4.14.0",
"object.entries": "^1.0.4",
"prom-client": "^7.0.0",
"response-time": "^2.3.2",
"spaden": "^7.13.1",
"yarn-issue-repro-package": "^1.0.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.18.0",
"browserify": "^13.1.1",
"browserify-middleware": "^7.1.0",
"cheerio": "^0.22.0",
"codeceptjs": "^0.4.13",
"del-cli": "^0.2.1",
"eslint": "^3.12.2",
"eslint-config-finn": "^1.0.1",
"espower-loader": "^1.0.1",
"hashmark": "^4.1.0",
"interfake": "^1.19.0",
"mocha": "^3.2.0",
"nightmare": "^2.9.0",
"nightmare-upload": "^0.1.1",
"nock": "^9.0.2",
"nodemon": "^1.11.0",
"nyc": "^10.0.0",
"power-assert": "^1.4.1",
"sinon": "^1.17.6",
"supertest": "^2.0.1",
"uglify-js": "^2.7.5",
"uglifyify": "^3.0.4"
}
}
package.json
的yarn-issue-repro-package
{
"name": "yarn-issue-repro-package",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"nunjucks": "^2.5.2",
"pretty-error": "^2.0.2",
"unleash-client": "^1.0.0-beta.7"
}
}
有趣的是,它会产生4个错误,而不是3个。
$ yarn check v0.20.0-0 │├─ [email protected]
error "yarn-issue-repro-package#nunjucks#chokidar#anymatch" not installed │└─ [email protected]
error "yarn-issue-repro-package#unleash-client#request#json-stringify-safe" not installed │✨ Done in 2.65s.
error "yarn-issue-repro-package#nunjucks#yargs#string-width#code-point-at" not installed │ ~/repos/yarn-issue-repro-package vim package.json
error "yarn-issue-repro-package#pretty-error#renderkid#css-select#domutils#dom-serializer#entities" not installed │ ~/repos/yarn-issue-repro-package npm publish
error Found 4 errors.
我不确定这是否是相同的问题,但这是输出(使用0.19.1测试)
我想我已经找到了安装问题的根本原因。
下面的package.json可以重现安装软件包的失败:
{ "dependencies": {
"bcrypt": "^1.0.1",
"gamepad": "1.4.2"
},
"devDependencies": {
"istanbul": "^1.0.0-alpha.2"
}
}
然后命令
rm -rf node_modules yarn.lock
yarn install
rm -rf node_modules
yarn install --production
npm ls abbrev
在此配置中,未安装abbrev
。
abbrev
由istanbul
和nopt
(从yarn why abbrev
可以看到)。 nopt
由istanbul
和node-pre-gyp
(由bcrypt
和gamepad
)。
在打包提升器中对abbrev
进行重复数据删除时,以下代码用于确定提升记录的新isIgnored函数:
// switch to non ignored if earlier deduped version was ignored
if (existing.isIgnored() && !info.isIgnored()) {
existing.isIgnored = info.isIgnored;
}
abbrev
是要处理的第一批提升记录之一。 那时,现有记录为istanbul#abbrev
(被忽略,因为istanbul
被忽略),重复记录为istanbul#nopt#abbrev
,由于相同的原因,该记录在当时也被忽略。
因为此时两个记录都被忽略了,所以忽略功能不会像预期的那样进行调整-因为nopt
在以后的重复数据删除中将由于node-pre-gyp
的依赖性而变得不可忽略。 两个记录的忽略状态都可以随时更改,因此新的忽略功能应将它们混合在一起。
确实,当我们将这些管线替换为时,安装问题就消失了
// switch to non ignored if earlier deduped version was ignored
if (existing.isIgnored()) {
if (info.isIgnored()) {
// both are ignored now, but any one could become non ignored later on.
let oldIsIgnored = existing.isIgnored;
existing.isIgnored = () => oldIsIgnored() && info.isIgnored();
} else {
existing.isIgnored = info.isIgnored;
}
}
@blexrob ,很棒的发现!
您会发送公关吗?
在Integration.js中,有一项禁用测试,用于“使用--production安装时不应失去依赖关系”,该问题现已修复。
@bestander ,仅对其进行了测试,并且此修复导致您提到的测试中的堆栈溢出,因此无法应用。 弹出以下循环:
d#es5-ext -> es6-symbol#es5-ext -> es6-set#es5-ext -> es6-iterator#es5-ext -> es6-map#es5-ext -> es5-ext#es6-iterator -> es6-set#es6-iterator -> es6-weak-map#es6-iterator -> event-emitter#es5-ext -> d#es5-ext
因此,天真的递归调用方法就出来了...
是的,我认为需要进行一些调整,但是这个想法似乎是正确的
我对带有纱线0.27.5-1的phantomjs-prebuilt
模块(作为依存关系)有这样的问题。
所以现在我在yarn install --production
之前做虚拟yarn add phantomjs-prebuilt
yarn install --production
。
我很遗憾地说,这在纱线1.3.2中似乎仍然是一个问题。
当我使用Yarn 1.3.2时,我在Netlify上的构建失败了,但在Yarn 0.18.2中成功了。
cannot find module 'are-we-there-yet'
且仅带有生产标记的生成错误。
@adamreisnz ,此线程太大,无法跟踪所有问题。
您能用repro脚本提出一个新的吗?
@bestander完成了,谢谢。
对于仍然无法正常工作并且不想安装jq的人,可以使用
$ python -c "import json; p = json.loads(open('package.json').read()); del p['devDependencies']; open('package.json', 'w').write(json.dumps(p, indent=2));"
我在纱线1.17.3
和lerna
monorepo的节点v10.16.2
中。 仍然面临同样的问题。
我也可以确认。
我有很多依赖性,但是当我使用yarn install --production
,仅安装了两个模块。
但是值得注意的是,我在一个Lerna monorepo上类似于@hannadrehman,带有Yarn工作区,这可以解释极端行为。
纱线版本:1.22.0
节点:v12.16.1
npm install --production
可以完美运行。
@hannadrehman问题的项目是您的monorepo的软件包吗?
与@ TAnas0相同的问题
最有用的评论
嘿,大家,很抱歉您已经有一段时间了。
我将把这个问题分配给我自己,现在这是当务之急,我将在假期期间尝试解决此问题。
非常欢迎使用隔离测试或修复(理想情况下)的帮助和PR。