使用npm安装forked react组件库

时间:2017-08-03 19:55:05

标签: javascript node.js git reactjs npm

我正在尝试npm install一个包含很多缺陷的好项目的分支https://github.com/codyc4321/react-data-components。我们需要我们自己的副本并进行更改,因此我将其分叉并从repo中删除。

cchilders:~/work_projects/myproject (feature/investigate-fixing-react-data-components-table) 
$ rm -rf node_modules/react-data-components/

cchilders:~/work_projects/myproject (feature/investigate-fixing-react-data-components-table) 
$ atom .

cchilders:~/work_projects/myproject (feature/investigate-fixing-react-data-components-table) 
$ npm i https://github.com/codyc4321/react-data-components
rehub-portal@1.0.0 /Users/cchilders/work_projects/myproject
├── UNMET PEER DEPENDENCY coffee-script@1.x
├── UNMET PEER DEPENDENCY react@15.4.0
└── react-data-components@1.1.1  (git+https://github.com/codyc4321/react-data-components.git#bfa230d806c59f4703346a8377b2e1938152cefd)

npm WARN coffee-loader@0.7.3 requires a peer of coffee-script@1.x but none was installed.
npm WARN react-simpletabs@0.7.0 requires a peer of react@0.12.x - 1.x but none was installed.
npm WARN react-test-renderer@15.5.4 requires a peer of react@^15.5.0 but none was installed.
npm WARN rehub-portal@1.0.0 No repository field.

cchilders:~/work_projects/myproject (feature/investigate-fixing-react-data-components-table) 
$ npm i --save coffee-script react
rehub-portal@1.0.0 /Users/cchilders/work_projects/myproject
├── coffee-script@1.12.7 
└─┬ UNMET PEER DEPENDENCY react@15.6.1
  └── create-react-class@15.6.0 

npm WARN react-simpletabs@0.7.0 requires a peer of react@0.12.x - 1.x but none was installed.
npm WARN rehub-portal@1.0.0 No repository field.

cchilders:~/work_projects/myproject (feature/investigate-fixing-react-data-components-table) 
$ npm i --save coffee-script react@15.6.1
rehub-portal@1.0.0 /Users/cchilders/work_projects/myproject
├── coffee-script@1.12.7 
└── UNMET PEER DEPENDENCY react@15.6.1

npm WARN react-simpletabs@0.7.0 requires a peer of react@0.12.x - 1.x but none was installed.
npm WARN rehub-portal@1.0.0 No repository field.

cchilders:~/work_projects/myproject (feature/investigate-fixing-react-data-components-table) 
$ node server-dev.js 


...

ERROR in ./client/components/tables/OrderMetricsDataTable.js
Module not found: Error: Can't resolve 'react-data-components' in '/Users/cchilders/work_projects/myproject/client/components/tables'
 @ ./client/components/tables/OrderMetricsDataTable.js 64:16-48
 @ ./client/controllers/OrderMetricsController.js
 @ ./client/main.js
 @ multi webpack-hot-middleware/client ./client/main.js

ERROR in ./client/components/tables/GenericTable.js
Module not found: Error: Can't resolve 'react-data-components' in '/Users/cchilders/work_projects/myproject/client/components/tables'
 @ ./client/components/tables/GenericTable.js 67:16-48
 @ ./client/controllers/checkoutEventLogController.js
 @ ./client/main.js
 @ multi webpack-hot-middleware/client ./client/main.js

 ...

如果我删除此内容并使用npm i react-data-components安装相同的代码,则可以正常使用。代码是一样的,因为我还没有做出我的更改,我很惊讶相同的代码没有安装。将他的代码放在我们的项目中(但不在节点模块中)会导致单词static出现语法错误,可能是因为他的代码中有一些TypeScript。

如何使用npm安装此分叉,以便在制作时更新我的​​更改?

1 个答案:

答案 0 :(得分:1)

将项目克隆到本地目录,然后运行npm install /path/to/cloned/directory