我想在Github上创建React Data Grid存储库,进行一些更改并将其安装在我的react应用中。
我在回购的package.json中添加了名称,版本和描述属性
我试图通过安装它 npm install username / repo_url#branch
它确实安装并构建了软件包,但是忽略了node_modules / react-data-grid / packages / * /中的dist和lib文件夹,我无法将其导入我的代码中。
我尝试过
1)在我的应用程序的.gitignore中注释dist
2)在我应用的package.json中添加带有dist的文件属性
没有任何效果。 我在做什么错了?
编辑
以下是@Derek Nguyen响应之后的堆栈跟踪
npm install piby180/react-data-grid#piby-current
> react-data-grid@1.0.0 postinstall C:\Users\Leo\Documents\Work\demos\myapp\node_modules\react-data-grid
> lerna bootstrap --no-ci && lerna run build
lerna notice cli v3.15.0
lerna info Bootstrapping 2 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna success Bootstrapped 2 packages
lerna notice cli v3.15.0
lerna info Executing command in 2 packages: "npm run build"
lerna ERR! npm run build exited 1 in 'react-data-grid'
lerna ERR! npm run build stdout:
> react-data-grid@7.0.0-alpha.13 build C:\Users\Leo\Documents\Work\demos\myapp\node_modules\react-data-grid\packages\react-data-grid
> tsc
error TS6053: File 'C:/Users/Leo/Documents/Work/demos/myapp/node_modules/react-data-grid/packages/react-data-grid-addons/src/index.ts' not found.
error TS6053: File 'C:/Users/Leo/Documents/Work/demos/myapp/node_modules/react-data-grid/packages/react-data-grid/src/index.ts' not found.
Found 2 errors.
lerna ERR! npm run build stderr:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-data-grid@7.0.0-alpha.13 build: `tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-data-grid@7.0.0-alpha.13 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Leo\AppData\Roaming\npm-cache\_logs\2019-07-17T14_35_42_219Z-debug.log
lerna ERR! npm run build exited 1 in 'react-data-grid'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-data-grid@1.0.0 postinstall: `lerna bootstrap --no-ci && lerna run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-data-grid@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!
答案 0 :(得分:0)
该软件包中的'postinstall'脚本运行lerna bootstrap
。根据{{3}},它将执行以下操作:
运行时,此命令将:
npm安装每个软件包的所有外部依赖项。
将所有相互依赖的Lerna软件包符号链接在一起。
npm在所有引导程序包中进行预发布(除非传递了--ignore-prepublish)。
npm在所有引导程序包中运行prepare。
/ packages中的软件包没有prepare或prepublish脚本。您应该能够通过修改root package.json的postinstall脚本来正确构建子包:
postinstall": "lerna bootstrap --no-ci && lerna run build",
我认为应该正确构建子包。