Yarn (JS) 命令失败,出现"Error: Could not find or load main class run"



我正在开发一个最近从npm切换到yarn的应用程序,我无法运行package.json脚本。运行带有yarn的命令会导致以下错误:

Error: Could not find or load main class run

使用npm运行相同的命令可以正常工作。例:

$ yarn run test
> Error: Could not find or load main class run
$ npm run test
> RUNS  test/jest/components/DataTable.test.js
> RUNS  test/jest/components/NavItem.test.js
> // etc

您还安装了 Apache Yarn,并且您的系统正在使用这种纱线。

若要确认,请运行yarn version,你将看到如下所示的内容:

hadoop 2.7.1
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r 15ec7ccf46de536e6ce7a
Compiled by jenkins on 2015-06-29T06:04Z
Compiled with protoc 2.5.0
From source with checksum fc0a1a23fc1868e4d5ee7fa2b28a58a
This command was run using 
/usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/common/hadoop-common-2.7.1.jar

您需要通过为其中一个命令添加别名来解决冲突。

你可以使用 yarnpkg 等同于纱线

yarnpkg run test

最新更新