最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

无法导入reactjs

IT培训 admin 7浏览 0评论

无法导入reactjs

我试图导入反应,我写了下面的代码:

import React from "react";

但是当我在写终端npm start它让我看到这些错误:

> [email protected] start /home/zx-coder/Downloads/reactjs-basics-master
> npm run build


> [email protected] build /home/zx-coder/Downloads/reactjs-basics-master
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot

 Hash: 2692c371e3a85309b95e Version: webpack 1.15.0 Time: 1020ms
        Asset    Size  Chunks             Chunk Names
    bundle.js  166 kB       0  [emitted]  main bundle.js.map  184 kB       0  [emitted]  main
    + 37 hidden modules events.js:183
      throw er; // Unhandled 'error' event
      ^

 Error: listen EADDRINUSE 127.0.0.1:8080
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1367:14)
    at listenInCluster (net.js:1408:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)

 npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
 "/usr/bin/npm" "run" "build" npm ERR! node v8.10.0 npm ERR! npm 
 v3.5.2 npm ERR! code ELIFECYCLE npm ERR! [email protected] build:
 `webpack -d &&cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build script 'webpack -d
 && cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this
 is most likely a problem with the reactjs-basics package, npm ERR! not
 with npm itself. npm ERR! Tell the author that this fails on your
 system: npm ERR!     webpack -d && cp src/index.html dist/index.html
 && webpack-dev-server --content-base src/ --inline --hot npm ERR! You
 can get information on how to open an issue for this project with: npm
 ERR!     npm bugs reactjs-basics npm ERR! Or if that isn't available,
 you can get their info via: npm ERR!     npm owner ls reactjs-basics
 npm ERR! There is likely additional logging output above.

 npm ERR! Please include the following file with anysupport request:
 npm ERR!    
 /home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log

 npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
 "/usr/bin/npm" "start" npm ERR! node v8.10.0 npm ERR! npm  v3.5.2 npm
 ERR! code ELIFECYCLE npm ERR! [email protected] start: `npm run
 build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
 [email protected] start script 'npm run build'. npm ERR! Make sure
 you have the latest version of node.js and npm installed. npm ERR! If
 you do, this is most likely a problem with the reactjs-basics package,
 npm ERR! not with npm itself. npm ERR! Tell the author that this fails
 on your system: npm ERR!     npm run build npm ERR! You can get
 information on how to open an issue for this project with: npm ERR!   
 npm bugs reactjs-basics npm ERR! Or if that isn't available, you can
 get their info via: npm ERR!     npm owner ls reactjs-basics npm ERR!
 There is likely additional logging output above.

 npm ERR! Please include the following file with anysupport request:
 npm ERR!    
 /home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log
回答如下:

该错误是Error: listen EADDRINUSE 127.0.0.1:8080这意味着已经有你的机器上使用端口8080的东西,尝试改变端口的WebPack开始开发服务器

无法导入reactjs

我试图导入反应,我写了下面的代码:

import React from "react";

但是当我在写终端npm start它让我看到这些错误:

> [email protected] start /home/zx-coder/Downloads/reactjs-basics-master
> npm run build


> [email protected] build /home/zx-coder/Downloads/reactjs-basics-master
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot

 Hash: 2692c371e3a85309b95e Version: webpack 1.15.0 Time: 1020ms
        Asset    Size  Chunks             Chunk Names
    bundle.js  166 kB       0  [emitted]  main bundle.js.map  184 kB       0  [emitted]  main
    + 37 hidden modules events.js:183
      throw er; // Unhandled 'error' event
      ^

 Error: listen EADDRINUSE 127.0.0.1:8080
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1367:14)
    at listenInCluster (net.js:1408:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)

 npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
 "/usr/bin/npm" "run" "build" npm ERR! node v8.10.0 npm ERR! npm 
 v3.5.2 npm ERR! code ELIFECYCLE npm ERR! [email protected] build:
 `webpack -d &&cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build script 'webpack -d
 && cp src/index.html dist/index.html && webpack-dev-server
--content-base src/ --inline --hot'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this
 is most likely a problem with the reactjs-basics package, npm ERR! not
 with npm itself. npm ERR! Tell the author that this fails on your
 system: npm ERR!     webpack -d && cp src/index.html dist/index.html
 && webpack-dev-server --content-base src/ --inline --hot npm ERR! You
 can get information on how to open an issue for this project with: npm
 ERR!     npm bugs reactjs-basics npm ERR! Or if that isn't available,
 you can get their info via: npm ERR!     npm owner ls reactjs-basics
 npm ERR! There is likely additional logging output above.

 npm ERR! Please include the following file with anysupport request:
 npm ERR!    
 /home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log

 npm ERR! Linux 4.15.0-29-generic npm ERR! argv "/usr/bin/node"
 "/usr/bin/npm" "start" npm ERR! node v8.10.0 npm ERR! npm  v3.5.2 npm
 ERR! code ELIFECYCLE npm ERR! [email protected] start: `npm run
 build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
 [email protected] start script 'npm run build'. npm ERR! Make sure
 you have the latest version of node.js and npm installed. npm ERR! If
 you do, this is most likely a problem with the reactjs-basics package,
 npm ERR! not with npm itself. npm ERR! Tell the author that this fails
 on your system: npm ERR!     npm run build npm ERR! You can get
 information on how to open an issue for this project with: npm ERR!   
 npm bugs reactjs-basics npm ERR! Or if that isn't available, you can
 get their info via: npm ERR!     npm owner ls reactjs-basics npm ERR!
 There is likely additional logging output above.

 npm ERR! Please include the following file with anysupport request:
 npm ERR!    
 /home/zx-coder/Downloads/reactjs-basics-master/npm-debug.log
回答如下:

该错误是Error: listen EADDRINUSE 127.0.0.1:8080这意味着已经有你的机器上使用端口8080的东西,尝试改变端口的WebPack开始开发服务器

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论