qq_39658059
Tool-Human
采纳率80%
2020-04-05 00:23

reactjs页面无法引入umi/link umi框架

已采纳

启动不了一直报错

E:\demo\react-demo>umi dev
Starting the development server...

× Webpack
  Compiled with some errors in 9.77s

 ERROR  Failed to compile with 1 errors                                                                                                                                                                                        0:21:26

This dependency was not found:

* umi/link in ./src/layouts/index.js

To install it, you can run: npm install --save umi/link

react项目页面引入umi/link 导入不了 下载一直报错

import Link from 'umi/link';

根据提示执行cnpm install --save umi/link 但是一直报错

E:\demo\react-demo>cnpm install --save umi/link
- [@umi/link] install  from git github:umi/link, may be very slow, please keep patience
/ [0/1] Installing @umi/linkdownload tarball failed: GET https://github.com/umi/link/tarball/master response 404 status, try to clone repository now.
git clone https://github.com/umi/link.git E:\demo\react-demo\node_modules\.tmp\b88c22e2-467d-4a93-83b5-12c63c098840
- [0/1] Installing @umi/link'git' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
× Install fail! Error: [@umi/link] Run "C:\WINDOWS\system32\cmd.exe /d /s /c git clone https://github.com/umi/link.git E:\demo\react-demo\node_modules\.tmp\b88c22e2-467d-4a93-83b5-12c63c098840" error, exit code 1
Error: [@umi/link] Run "C:\WINDOWS\system32\cmd.exe /d /s /c git clone https://github.com/umi/link.git E:\demo\react-demo\node_modules\.tmp\b88c22e2-467d-4a93-83b5-12c63c098840" error, exit code 1
    at module.exports (C:\Users\chenlijun\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\download\git.js:51:11)
    at module.exports.throw (<anonymous>)
    at onRejected (C:\Users\chenlijun\AppData\Roaming\npm\node_modules\cnpm\node_modules\co\index.js:81:24)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
npminstall version: 3.27.0
npminstall args: D:\node\node.exe C:\Users\chenlijun\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\chenlijun\.cnpmrc --disturl=https://npm.taobao.org/
mirrors/node --registry=https://r.npm.taobao.org --save umi/link

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • anthony715 anthony715 1年前

    官方文档
    路由
    Link
    Provides declarative, accessible navigation around your application.

    import { Link } from 'umi';
    你用的是早版本的写法

    点赞 5 评论 复制链接分享
  • Vlim_dd Vlim_dd 6月前

    多谢!我也是这个错误,找了半天

    点赞 评论 复制链接分享

相关推荐