首页 > 解决方案 > 为什么纱线会跳过我的路径?以及如何使用纱线脚本中的命令

问题描述

我正在尝试启动一个使用 yarn 构建的项目,但是在运行使用常用命令的脚本(例如 mkdir)时遇到了一些问题

手头的项目是 kdcio 的 abu-cms ( https://github.com/kdcio/abu )

由于使用 mkdir 的错误,yarn setup:local 失败(调用的脚本是资源文件夹中的 setup:local:ddb)

当我尝试执行单个步骤时的输出如下(从主工作区运行整个脚本相同):

mattia@mattia-ubnt:~/abu$ yarn workspace res setup:local:ddb
yarn workspace v1.22.10
yarn run v1.22.10
$ mkdir -p .dbdata && yarn start && yarn ddb:wait && yarn ddb:init
/bin/bash: line 1: mkdir: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 127
Command: /usr/bin/node
Arguments: /usr/local/lib/node_modules/yarn/lib/cli.js setup:local:ddb
Directory: /home/mattia/abu/resources
Output:

我手动创建了 .dbdata 文件夹并尝试执行 ddb:init 步骤(使用 aws cli,在我的系统中正确安装和配置)并失败并出现类似错误:

mattia@mattia-ubnt:~/abu$ yarn workspace res ddb:init
yarn workspace v1.22.10
yarn run v1.22.10
$ aws dynamodb create-table --cli-input-json file://schema.json --endpoint-url http://localhost:8062 --region ap-southeast-1 --output text --query 'Table.TableName'
/bin/bash: line 1: aws: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 127
Command: /usr/bin/node
Arguments: /usr/local/lib/node_modules/yarn/lib/cli.js ddb:init
Directory: /home/mattia/abu/resources
Output:

你能帮我理解为什么这些命令在 yarn 的 PATH 中不可用吗?

如果您认为对我的环境进行更多配置可能有助于找到问题,请告诉我,我会尽我所能尽快提供。

谢谢!

标签: javascriptnode.jsnpmbuildyarnpkg

解决方案


推荐阅读