目前的调查开始于我在将Material_UI软件包安装到我刚刚安装了React Starter Kit的目录中时收到的丢失的同行报告,该报告给出了以下报告.
Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts... > uglifyjs-webpack-plugin@0.4.6 postinstall F:\Praesidium\Armatus_Admin_EventRegistration\React\material_ui_table_demo\node_modules\uglifyjs-webpack-plugin > node lib/post_install.js + react-scripts@1.1.2 + react@16.3.0 + react-dom@16.3.0 added 1327 packages in 86.861s Success! Created material_ui_table_demo at F:\Praesidium\Armatus_Admin_EventRegistration\React\material_ui_table_demo Inside that directory, you can run several commands: ...
安装Material_UI会引出以下报告.
npm install material-ui@next > jss@9.8.1 postinstall F:\Praesidium\Armatus_Admin_EventRegistration\React\material_ui_table_demo\node_modules\jss > node -e "console.log('\u001b[35m\u001b[1mLove JSS? You can now support us on open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/jss/donate\u001b[0m')" Love JSS? You can now support us on open collective: > https://opencollective.com/jss/donate npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + material-ui@1.0.0-beta.40 added 47 packages in 23.878s
在调查AJV包之后,我决定从入门工具包生成依赖树.依赖关系树在前面提到的AJV包上报告了一个对等依赖关系,安装程序没有报告.
然而,令人费解的是,npm列表中报告的所谓丢失包的列表.
material_ui_table_demo_Packages_Skeleton_20180402_211705.TXT是覆盖React Starter Kit的npm列表报告.
material_ui_table_demo_Packages_Skeleton_20180402_211705_STDOUT.TXT是在终端控制台上报告的缺失包的列表.
由于它会影响依赖关系树,因此您必须知道此安装位于Microsoft Windows 10 Professional上,并且已安装的NPM和Node版本分别为5.6.0和v8.10.0.
React Starter Kit Installation Instructions对于开发人员必须解决的未解决的依赖关系是无声的.我相信哪个报告,依赖树或缺少的包由同一个npm列表单独报告?
在第一个npm安装中没有安装软件包的问题已经出现在那里.再次运行npm install通常会解决问题,但在某些情况下(如此),您必须通过执行以下步骤强制执行包版本:
>删除node_modules文件夹
>删除package-lock.json
>将确切的依赖项添加到package.json(在我们的例子中为ajv@^6.0.0)
>执行npm update(以防万一)
>执行npm install
现在下午ERR!缺少peer dep:ajv@^6.0.0,ajv-keywords@3.1.0不再需要!
注意:如何添加依赖项:
... "dependencies": { "ajv": "^6.0.0", ...
为什么?它是npm依赖系统的一个bug(他们在某个时候添加了一个hacky解决方案,然后他们删除了它们,他们说他们会在某个时候重写整个依赖系统)