【发布时间】:2022-06-22 21:04:49
【问题描述】:
我正在构建 react 组件库。
我需要“npm 链接”我的库项目以使用位于主项目中的 react-redux
我这样做就像'npm link ../MainProject/node_modules/react-redux'
但它给了我一个错误:
npm ERR! code 1
npm ERR! path C:\Users\jamal\WorkspaceAmavisca\Cerebrum-Administration\node_modules\react-redux
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c npm run clean && npm run build
npm ERR! > react-redux@7.2.6 clean
npm ERR! > rimraf lib dist es coverage
npm ERR!
npm ERR!
npm ERR! > react-redux@7.2.6 build
npm ERR! > npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min
npm ERR!
npm ERR!
npm ERR! > react-redux@7.2.6 build:commonjs
npm ERR! > cross-env BABEL_ENV=commonjs babel src --out-dir lib
npm ERR! 'cross-env' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
当我将 cross-env 安装为全局时,然后再次尝试 npm 链接。 它给了我错误:
> npm ERR! Error: spawn babel ENOENT npm ERR! at notFoundError
> (C:\Users\jamal\Apps\nvm\v16.13.1\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
显然,当我执行 npm 链接时, 似乎 react-redux 再次运行他们的构建脚本但失败了。
有什么帮助吗?
谢谢
- React-Redux:7.2.1 和 7.2.6
- 反应:16.14.0
- ReactDOM:16.14.0
- Redux:4.0.5 反应
- Redux:7.2.1
- 节点 16.13.1
- NPM:8.1.2
【问题讨论】:
-
您找到解决方案了吗?我有同样的问题....
标签: reactjs react-redux