此命令无法将资产链接到项目。
npx react-native link
错误提示:
未知命令“链接”
将资产与本机反应中的项目应用程序链接
即使我使用 npx react-native-asset 命令,我仍然面临错误:
$ npx react-native-asset
node:fs:1643
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat 'C:\Users\dbzna\Desktop\mern stack\blooddonation1\client\assets\fonts'
at Object.lstatSync (node:fs:1643:25)
at loadAsset (C:\Users\dbzna\AppData\Local\npm-cache\_npx\545c366a5ae830a2\node_modules\react-native-asset\lib\index.js:80:22)
at Array.forEach (<anonymous>)
at C:\Users\dbzna\AppData\Local\npm-cache\_npx\545c366a5ae830a2\node_modules\react-native-asset\lib\index.js:94:15
at Array.forEach (<anonymous>)
at module.exports (C:\Users\dbzna\AppData\Local\npm-cache\_npx\545c366a5ae830a2\node_modules\react-native-asset\lib\index.js:288:6)
at Object.<anonymous> (C:\Users\dbzna\AppData\Local\npm-cache\_npx\545c366a5ae830a2\node_modules\react-native-asset\lib\cli.js:56:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32) {
errno: -4058,
code: 'ENOENT',
syscall: 'lstat',
path: 'C:\\Users\\dbzna\\Desktop\\mern stack\\blooddonation1\\client\\assets\\fonts'
}
Node.js v20.11.1
我也遇到了同样的问题,解决办法是检查文件 反应本机.config.js 检查“资产”中的路线,我错了。