最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError: React.renderToStaticMarkup is not a function - Stack Overflow

programmeradmin3浏览0评论

I am following this tutorial "Building SVG Icons with React"

/

I am getting stuck when i am running the mand "npm run build"

This is the npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/Users/villat/.nvm/versions/node/v5.0.0/bin/node',
1 verbose cli   '/Users/villat/.nvm/versions/node/v5.0.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 silly lifecycle [email protected]~prebuild: no script for prebuild, continuing
7 info lifecycle [email protected]~build: [email protected]
8 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build: PATH: /Users/villat/.nvm/versions/node/v5.0.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/villat/Downloads/Projects/react-icons/node_modules/.bin:/Users/villat/.nvm/versions/node/v5.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle [email protected]~build: CWD: /Users/villat/Downloads/Projects/react-icons
11 silly lifecycle [email protected]~build: Args: [ '-c', 'node build' ]
12 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build: Failed to exec build script
14 verbose stack Error: [email protected] build: `node build`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/Users/villat/.nvm/versions/node/v5.0.0/lib/node_modules/npm/lib/utils/lifecycle.js:233:16)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at EventEmitter.emit (events.js:172:7)
14 verbose stack     at ChildProcess.<anonymous> (/Users/villat/.nvm/versions/node/v5.0.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at ChildProcess.emit (events.js:172:7)
14 verbose stack     at maybeClose (internal/child_process.js:818:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/villat/Downloads/Projects/react-icons
17 error Darwin 15.4.0
18 error argv "/Users/villat/.nvm/versions/node/v5.0.0/bin/node" "/Users/villat/.nvm/versions/node/v5.0.0/bin/npm" "run" "build"
19 error node v5.0.0
20 error npm  v3.3.6
21 error code ELIFECYCLE
22 error [email protected] build: `node build`
22 error Exit status 1
23 error Failed at the [email protected] build script 'node build'.
23 error This is most likely a problem with the react-icons package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     node build
23 error You can get their info via:
23 error     npm owner ls react-icons
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

In attached my terminal screenshot where it is plaining about React.renderToStaticMarkup

I have done a bit of research and i have not found any relevant solution for me

I am using nvm to manage the node versions

My node -v version is 5.0.0

I am following this tutorial "Building SVG Icons with React"

http://jxnblk./react-icons/

I am getting stuck when i am running the mand "npm run build"

This is the npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/Users/villat/.nvm/versions/node/v5.0.0/bin/node',
1 verbose cli   '/Users/villat/.nvm/versions/node/v5.0.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 silly lifecycle [email protected]~prebuild: no script for prebuild, continuing
7 info lifecycle [email protected]~build: [email protected]
8 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build: PATH: /Users/villat/.nvm/versions/node/v5.0.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/villat/Downloads/Projects/react-icons/node_modules/.bin:/Users/villat/.nvm/versions/node/v5.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle [email protected]~build: CWD: /Users/villat/Downloads/Projects/react-icons
11 silly lifecycle [email protected]~build: Args: [ '-c', 'node build' ]
12 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build: Failed to exec build script
14 verbose stack Error: [email protected] build: `node build`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/Users/villat/.nvm/versions/node/v5.0.0/lib/node_modules/npm/lib/utils/lifecycle.js:233:16)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at EventEmitter.emit (events.js:172:7)
14 verbose stack     at ChildProcess.<anonymous> (/Users/villat/.nvm/versions/node/v5.0.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at ChildProcess.emit (events.js:172:7)
14 verbose stack     at maybeClose (internal/child_process.js:818:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/villat/Downloads/Projects/react-icons
17 error Darwin 15.4.0
18 error argv "/Users/villat/.nvm/versions/node/v5.0.0/bin/node" "/Users/villat/.nvm/versions/node/v5.0.0/bin/npm" "run" "build"
19 error node v5.0.0
20 error npm  v3.3.6
21 error code ELIFECYCLE
22 error [email protected] build: `node build`
22 error Exit status 1
23 error Failed at the [email protected] build script 'node build'.
23 error This is most likely a problem with the react-icons package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     node build
23 error You can get their info via:
23 error     npm owner ls react-icons
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

In attached my terminal screenshot where it is plaining about React.renderToStaticMarkup

I have done a bit of research and i have not found any relevant solution for me

I am using nvm to manage the node versions

My node -v version is 5.0.0

Share Improve this question asked May 27, 2016 at 8:42 Koala7Koala7 1,4248 gold badges43 silver badges88 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

renderToStaticMarkup has moved to react-dom/server.

http://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostaticmarkup

You need to install react-dom.

npm install react-dom

And use it.

var ReactDOMServer = require('react-dom/server');
ReactDOMServer.renderToStaticMarkup(<div />);
发布评论

评论列表(0)

  1. 暂无评论