为什么在安装react-bootstrap时出现错误?

时间:2019-02-27 14:34:33

标签: reactjs react-bootstrap

我试图安装react-bootstrap,但在控制台上收到以下消息。

enter image description here

由于我是新接触React的人,我将不胜感激

2 个答案:

答案 0 :(得分:1)

尝试一下:

  1. 确保您拥有最新的npm(@IBDesignable public class GoalCheckView: UIView { // MARK: - Public properties @IBInspectable public var isComplete: Bool = false { didSet { setNeedsLayout() } } // MARK: - Private properties private lazy var checkImage: UIImage? = { let bundle = Bundle(for: type(of: self)) return UIImage(named: "check_event_carblog_confirm", in: bundle, compatibleWith: nil) }() private var checkImageSize: CGSize { let widthRatio: CGFloat = 15 / 24 // Size of image is 15x13 when circle is 24x24 let heightRatio: CGFloat = 13 / 24 return CGSize(width: bounds.width * widthRatio, height: bounds.height * heightRatio) } private let circleLayer = CAShapeLayer() private let checkLayer = CALayer() private let lineWidth: CGFloat = 1 // MARK: - View lifecycle public override init(frame: CGRect) { super.init(frame: frame) setupView() } public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setupView() } public override func layoutSubviews() { super.layoutSubviews() // Layout circle let path = UIBezierPath(ovalIn: bounds.insetBy(dx: lineWidth / 2, dy: lineWidth / 2)) circleLayer.path = path.cgPath // Layout check checkLayer.frame = CGRect( origin: CGPoint(x: bounds.midX - checkImageSize.width / 2, y: bounds.midY - checkImageSize.height / 2), size: checkImageSize ) checkLayer.opacity = isComplete ? 1 : 0 } // MARK: - Private methods private func setupView() { // Setup circle layer circleLayer.lineWidth = lineWidth circleLayer.fillColor = nil circleLayer.strokeColor = UIColor(named: "goal_empty", in: bundle, compatibleWith: nil)?.cgColor layer.addSublayer(circleLayer) // Setup check layer checkLayer.contentsScale = UIScreen.main.scale checkLayer.contentsGravity = .resizeAspect checkLayer.contents = checkImage?.cgImage layer.addSublayer(checkLayer) } } )。
  2. 向防病毒添加例外,以忽略项目中的npm install -g npm文件夹。
  3. 确保没有其他的node.js进程正在运行(检查任务管理器)
  4. 如果您使用的是Visual Studio Code,请关闭它。
  5. node_modules
  6. rm -rf node_modules package-lock.json然后是npm install

答案 1 :(得分:-1)

尝试不要将您的项目文件夹命名为react-bootstrap