A-A+

react-treeview-master安装出错解决方案

2017年09月11日 APP开发 暂无评论 阅读 564 views 次

react怎么实现树形面板

可以考虑用这个东西

react-treeview-master

出错情况如下:

PS D:\reactjs> cd .\react-treeview-master\
PS D:\reactjs\react-treeview-master> cnpm install
√ Installed 11 packages
√ Linked 0 latest versions
√ Run 0 scripts
√ All packages installed (used 36ms, speed 0B/s, json 0(0B), tarball 0B)
PS D:\reactjs\react-treeview-master> cnpm run
Lifecycle scripts included in react-treeview:
  start
    cross-env NODE_ENV=development node server.js

available via `npm run-script`:
  lint
    eslint src demos
  build-demos
    cross-env NODE_ENV=production webpack -p
  prerelease
    babel src --out-dir lib && cross-env NODE_ENV=production webpack --config webpack.prod.config.js
PS D:\reactjs\react-treeview-master> cnpm start

> react-treeview@0.4.7 start D:\reactjs\react-treeview-master
> cross-env NODE_ENV=development node server.js

module.js:491
    throw err;
    ^

Error: Cannot find module 'enhanced-resolve/lib/ModuleAliasPlugin'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\reactjs\react-treeview-master\node_modules\_webpack@1.15.0@webpack\lib\CompatibilityPlugin
.js:8:25)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-treeview@0.4.7 start: `cross-env NODE_ENV=development node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-treeview@0.4.7 start 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\acer\AppData\Roaming\npm-cache\_logs\2017-09-11T09_28_00_448Z-debug.log
PS D:\reactjs\react-treeview-master> npm run prerelease

> react-treeview@0.4.7 prerelease D:\reactjs\react-treeview-master
> babel src --out-dir lib && cross-env NODE_ENV=production webpack --config webpack.prod.config.js

module.js:491
    throw err;
    ^

Error: Cannot find module 'babel-core/lib/transformation/modules'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\reactjs\react-treeview-master\node_modules\_babel@5.8.38@babel\lib\babel\index.js:6:24)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-treeview@0.4.7 prerelease: `babel src --out-dir lib && cross-env NODE_ENV=production webpack --config web
pack.prod.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-treeview@0.4.7 prerelease 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\acer\AppData\Roaming\npm-cache\_logs\2017-09-11T09_28_58_357Z-debug.log
PS D:\reactjs\react-treeview-master> cnpm install babel-runtime
√ Installed 1 packages
√ Linked 2 latest versions
√ Run 0 scripts
√ All packages installed (3 packages installed from npm registry, used 3s, speed 7.83kB/s, json 3(20.14kB), tarball 0B)
PS D:\reactjs\react-treeview-master> npm run prerelease

> react-treeview@0.4.7 prerelease D:\reactjs\react-treeview-master
> babel src --out-dir lib && cross-env NODE_ENV=production webpack --config webpack.prod.config.js

module.js:491
    throw err;
    ^

Error: Cannot find module 'babel-core/lib/transformation/modules'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\reactjs\react-treeview-master\node_modules\_babel@5.8.38@babel\lib\babel\index.js:6:24)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-treeview@0.4.7 prerelease: `babel src --out-dir lib && cross-env NODE_ENV=production webpack --config web
pack.prod.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-treeview@0.4.7 prerelease 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\acer\AppData\Roaming\npm-cache\_logs\2017-09-11T09_30_54_138Z-debug.log

找了好多网上的文章,搞不定。

最后索性把

node_modules\

删除了,再走了一次流程。终于成功。

PS D:\reactjs\react-treeview-master> cnpm install
\ [7/11] Installing invert-kv@^1.0.0platform unsupported webpack@1.15.0 › watchpack@0.2.9 › chokidar@1.7.0 › fsevents@^1
.0.0 Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(win32)
√ Installed 11 packages
√ Linked 321 latest versions
√ Run 0 scripts
deprecate babel-eslint@4.1.8 › babel-core@5.8.38 › minimatch@^2.0.3 Please update to minimatch 3.0.2 or higher to avoid
a RegExp DoS issue
Recently updated (since 2017-09-04): 7 packages (detail see file D:\reactjs\react-treeview-master\node_modules\.recently
_updates.txt)
  Today:
    → webpack-dev-server@1.16.5 › express@4.15.4 › content-type@~1.0.2(1.0.3) (12:44:08)
    → webpack-dev-server@1.16.5 › express@4.15.4 › proxy-addr@1.1.5 › forwarded@~0.1.0(0.1.1) (07:15:48)
    → webpack-dev-server@1.16.5 › sockjs@0.3.18 › faye-websocket@0.10.0 › websocket-driver@0.6.5 › websocket-extensions
@>=0.1.1(0.1.2) (00:50:38)
√ All packages installed (366 packages installed from npm registry, used 18s, speed 35.95kB/s, json 332(651.17kB), tarb
all 0B)
PS D:\reactjs\react-treeview-master> cnpm run prerelease

> react-treeview@0.4.7 prerelease D:\reactjs\react-treeview-master
> babel src --out-dir lib && cross-env NODE_ENV=production webpack --config webpack.prod.config.js

src\react-treeview.jsx -> lib\react-treeview.js
Hash: 5909c7660dec26bdaf7c
Version: webpack 1.15.0
Time: 1848ms
             Asset     Size  Chunks             Chunk Names
 react-treeview.js  44.4 kB       0  [emitted]  index
react-treeview.map  64.8 kB       0  [emitted]  index
    + 11 hidden modules
PS D:\reactjs\react-treeview-master> cnpm start

> react-treeview@0.4.7 start D:\reactjs\react-treeview-master
> cross-env NODE_ENV=development node server.js

Listening at localhost:3000
Hash: d46b55c9fef349d4bea3
Version: webpack 1.15.0
Time: 3138ms
    Asset     Size  Chunks             Chunk Names
bundle.js  1.14 MB       0  [emitted]  main
chunk    {0} bundle.js (main) 985 kB [rendered]
webpack: Compiled successfully.

最终效果图

2017-09-11_174303

打赏作者
如果文章对您有所帮助请打赏支持本站发展。

您的支持将鼓励我们继续创作!

[微信] 扫描二维码打赏

[支付宝] 扫描二维码打赏

标签:

给我留言

您必须 登录 才能发表留言!

Copyright © 前端技术分享休闲玩耍去处分享-大一网 保留所有权利.   Theme  Ality

用户登录 ⁄ 注册

分享到: