ReactJS npm start编译失败

时间:2018-06-21 12:51:21

标签: reactjs three.js renderer

npm start
  • react@16.4.1
  • react-dom@16.4.1
  • 三个反应器

App.js

import React3 from 'react-three-renderer';
import * as THREE from 'three';
import React from "react";
import ReactDOM from 'react-dom';

警告

npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-three@0.9.7 requires a peer of react@^15.4.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-three@0.9.7 requires a peer of react-dom@^15.4.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-three@0.9.7 requires a peer of three@^0.83.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-three-renderer@3.2.4 requires a peer of react@~15.6.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-three-renderer@3.2.4 requires a peer of react-dom@~15.6.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-three-renderer@3.2.4 requires a peer of three@~0.86.0 but none is installed. You must install peer dependencies yourself.
  

节点脚本/start.js

启动开发服务器...

无法编译。

./node_modules/react-three-renderer/lib/React3CompositeComponentWrapper.js
Module not found: Can't resolve 'react-dom/lib/ReactCompositeComponent' in '/Users/ernekyan/react-app/project/node_modules/react-three-renderer/lib'

有人可以给我建议吗?

1 个答案:

答案 0 :(得分:0)

您可以再次尝试npm install来查看是否已安装所有软件包。

相反,您可以通过运行npm install <package> -D(自动保存到package.json)来自己添加软件包

或在此处查看提供的解决方案:npm WARN ... requires a peer of ... but none is installed. You must install peer dependencies yourself,因为自动安装的peerDependencies已从npm v3 +中删除。

更多信息:https://github.com/npm/npm/releases/tag/v3.0.0

#6930(#6565)peerDependencies不再导致隐式安装任何内容。相反,npm现在会警告是否缺少程序包peerDependencies,但这取决于模块的使用者(即您),以确保对等程序已安装/作为程序包的直接依赖项或devDependencies包含在package.json中。 em>