【发布时间】:2021-01-29 11:32:21
【问题描述】:
当我运行 yarn start 或任何其他以下脚本时:
"scripts": {
"start": "webpack-dev-server --config scripts/webpack.dev.js",
"clean": "rimraf build",
"build": "yarn run clean && yarn run compile",
"compile": "webpack --config scripts/webpack.prod.js",
"compile-for-test": "webpack --config scripts/webpack.test.prod.js",
"build-for-test": "yarn run clean && yarn run compile-for-test",
"test": "jest -c scripts/jest.config.js --testPathIgnorePatterns=\"services/contract-tests\"",
"test-ci": "node scripts/test-shell-commands.js unitTestCI",
"test-contract": "node scripts/test-shell-commands.js testLocal",
"test-contract-ci": "node scripts/test-shell-commands.js testCI",
"coverage": "node scripts/test-shell-commands.js unitTestCoverage",
"lint": "./node_modules/.bin/eslint --max-warnings=0 \"src/**\"",
"start-backend": "bash -l ./scripts/start-backend-container.sh",
"stop-backend": "bash -l ./scripts/stop-backend-container.sh",
"start-stub": "bash -l ./scripts/start-backend-stub-container.sh",
"stop-stub": "bash -l ./scripts/stop-backend-stub-container.sh",
"prettier": "prettier --write **/*{ts,tsx}"
},
我收到以下错误:
# yarn start
$ webpack-dev-server --config scripts/webpack.dev.js
error Couldn't find the binary webpack-dev-server --config scripts/webpack.dev.js
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
# yarn test
$ jest -c scripts/jest.config.js --testPathIgnorePatterns="services/contract-tests"
error Couldn't find the binary jest -c scripts/jest.config.js --testPathIgnorePatterns="services/contract-tests"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
这适用于所有脚本(不适用于 webpack 等)。但是,当我使用它npm run start 时,它可以工作。 yarn add 或 yarn 命令单独也可以工作。只是我无法使用yarn 运行任何脚本。
有人遇到过这种情况吗?
我的纱线版本是:1.22.10
我已经卸载并安装了几次,但问题仍然存在。操作系统:Windows
【问题讨论】:
-
您是否可能使用过不间断个空格?
-
我仔细检查过,但事实并非如此。
-
当您尝试运行
script时,yarn似乎无法找到可执行依赖项。我建议删除node_modules文件夹,运行yarn cache clean。之后运行yarn install并尝试运行yarn start。 -
运行
yarn config get script-shell的回报是多少? -
@iLuvLogix 在你提出问题后我意识到它不是在寻找正确的路径。请回答问题,我会接受:)