我正在尝试通过git / github安装React.js
包。
直接通过npm安装包。不幸的是react-bootstrap/dom-helpers有一个bug,并且存储库所有者/创建者不愿意合并修复。
所以我创建了自己的repo并应用了手动修复。然后我想通过git / github安装它(比创建npm包并分发它更快 - 我不知道怎么做)。
所以我在package.json
添加了一行:
"dependencies": {
[...]
"dom-helpers": "git://github.com/GovPredict/dom-helpers.git",
然后我发现这个repo非常差package.json
(它没有files
选项等),当你通过git
安装它然后检查路径
./node_modules/dom-helpers/
您找到没有源代码的目录(默认情况下只包含文件:LICENSE
,README.md
。)
我做了一些修改,而且几乎可以正常工作......
我差点说,因为看起来webpack
没有加载回购或... package.json
仍有错误。
当我运行webpack开发时,我有
ERROR in ../~/react-big-calendar/lib/Agenda.js
Module not found: Error: Can't resolve 'dom-helpers/class' in '/Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/lib'
resolve 'dom-helpers/class' in '/Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/lib'
Parsed request is a module
using description file: /Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/package.json (relative path: ./lib)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/package.json (relative path: ./lib)
resolve as module
/Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/lib/node_modules doesn't exist or is not a directory
/Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/node_modules doesn't exist or is not a directory
/Users/maciejkowalski/projects/SomeProject/node_modules/node_modules doesn't exist or is not a directory
/Users/maciejkowalski/projects/GovPredict/node_modules doesn't exist or is not a directory
/Users/maciejkowalski/projects/node_modules doesn't exist or is not a directory
/Users/maciejkowalski/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/maciejkowalski/projects/SomeProject/front
using description file: /Users/maciejkowalski/projects/SomeProject/package.json (relative path: ./front)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/maciejkowalski/projects/SomeProject/package.json (relative path: ./front)
using description file: /Users/maciejkowalski/projects/SomeProject/package.json (relative path: ./front/dom-helpers/class)
as directory
/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class doesn't exist
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class.js doesn't exist
.jsx
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class.jsx doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class.json doesn't exist
looking for modules in /Users/maciejkowalski/projects/SomeProject/node_modules
using description file: /Users/maciejkowalski/projects/SomeProject/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/maciejkowalski/projects/SomeProject/package.json (relative path: ./node_modules)
using description file: /Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/package.json (relative path: ./class)
as directory
/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class doesn't exist
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class.js doesn't exist
.jsx
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class.jsx doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class.json doesn't exist
[/Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/lib/node_modules]
[/Users/maciejkowalski/projects/SomeProject/node_modules/react-big-calendar/node_modules]
[/Users/maciejkowalski/projects/SomeProject/node_modules/node_modules]
[/Users/maciejkowalski/projects/GovPredict/node_modules]
[/Users/maciejkowalski/projects/node_modules]
[/Users/maciejkowalski/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class]
[/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class]
[/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class.js]
[/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class.jsx]
[/Users/maciejkowalski/projects/SomeProject/front/dom-helpers/class.json]
[/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class]
[/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class]
[/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class.js]
[/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class.jsx]
[/Users/maciejkowalski/projects/SomeProject/node_modules/dom-helpers/class.json]
@ ../~/react-big-calendar/lib/Agenda.js 9:13-41
@ ../~/react-big-calendar/lib/Views.js
@ ../~/react-big-calendar/lib/Calendar.js
@ ../~/react-big-calendar/lib/index.js
@ ./components/under-the-dome-calendar/under-the-dome-calendar.jsx
@ ./application.js
如您所见,加载文件(webpack
)或package时出现了问题。
如何解决(质量问题)?
编辑1
看起来当你通过npm包安装文件(没有git)然后
./node_modules/dom-helpers/
看起来像
% ls -lah
total 56
drwxr-xr-x 14 maciejkowalski staff 476B 6 kwi 20:45 .
drwxr-xr-x 8 maciejkowalski staff 272B 6 kwi 21:39 ..
-rw-r--r-- 1 maciejkowalski staff 4,6K 4 lut 15:08 README.md
-rw-r--r-- 1 maciejkowalski staff 593B 4 lut 15:14 activeElement.js
drwxr-xr-x 6 maciejkowalski staff 204B 6 kwi 20:45 class
drwxr-xr-x 7 maciejkowalski staff 238B 6 kwi 20:45 events
-rw-r--r-- 1 maciejkowalski staff 1,9K 4 lut 15:14 index.js
-rw-r--r-- 1 maciejkowalski staff 231B 4 lut 15:14 ownerDocument.js
-rw-r--r-- 1 maciejkowalski staff 490B 4 lut 15:14 ownerWindow.js
-rw-r--r-- 1 maciejkowalski staff 2,5K 6 kwi 20:45 package.json
drwxr-xr-x 16 maciejkowalski staff 544B 6 kwi 20:45 query
drwxr-xr-x 5 maciejkowalski staff 170B 6 kwi 20:45 style
drwxr-xr-x 7 maciejkowalski staff 238B 6 kwi 20:45 transition
drwxr-xr-x 10 maciejkowalski staff 340B 6 kwi 20:45 util
然而,当我通过git安装我的dom-helpers fork时,我有:
% ls -lah
total 48
drwxr-xr-x 6 maciejkowalski staff 204B 6 kwi 21:43 .
drwxr-xr-x 610 maciejkowalski staff 20K 6 kwi 21:43 ..
-rw-r--r-- 1 maciejkowalski staff 1,1K 6 kwi 21:43 License.txt
-rw-r--r-- 1 maciejkowalski staff 4,6K 6 kwi 21:43 README.md
-rw-r--r-- 1 maciejkowalski staff 9,3K 6 kwi 21:43 package.json
drwxr-xr-x 12 maciejkowalski staff 408B 6 kwi 21:43 src
编译过程出了问题。
如何解决?