首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >npm开始显示错误代码npm ERR!代码ELIFECYCLE

npm开始显示错误代码npm ERR!代码ELIFECYCLE
EN

Stack Overflow用户
提问于 2018-10-29 14:51:02
回答 1查看 720关注 0票数 1

当我试图加载一个我从web下载的项目时,它显示了下面的错误。我尝试了清理缓存和npm安装,但仍然显示下面的错误。

代码语言:javascript
复制
> reactjs-basics@1.0.0 start D:\React\reactjs-basics-11-router
> npm run build


> reactjs-basics@1.0.0 build D:\React\reactjs-basics-11-router
> webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot --history-api-fallback

Hash: e5125e0911e8a3ceea45
Version: webpack 1.15.0
Time: 1807ms
        Asset     Size  Chunks             Chunk Names
    bundle.js     1 MB       0  [emitted]  main
bundle.js.map  1.09 MB       0  [emitted]  main
    + 251 hidden modules
'cp' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactjs-basics@1.0.0 build: `webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot --history-api-fallback`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 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\Aqib.Saman\AppData\Roaming\npm-cache\_logs\2018-10-29T06_47_07_547Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactjs-basics@1.0.0 start: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 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\Aqib.Saman\AppData\Roaming\npm-cache\_logs\2018-10-29T06_47_07_609Z-debug.log

我试着像一些人说的那样把cp改成copy,但是我得到了下面的错误

代码语言:javascript
复制
The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactjs-basics@1.0.0 build: `webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot --history-api-fallback`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 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\Aqib.Saman\AppData\Roaming\npm-cache\_logs\2018-10-29T08_03_45_949Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactjs-basics@1.0.0 start: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 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\Aqib.Saman\AppData\Roaming\npm-cache\_logs\2018-10-29T08_03_46_008Z-debug.log

厕所好像有什么不对劲,如果有人能帮上忙,我将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2018-10-29 15:09:42

您的问题来自于此处的复制操作webpack -d && cp src/index.html dist/index.html

我假设您使用的是windows操作系统来运行这段代码,并且windows中没有cp命令。

您应该尝试用下面的代码替换上面的代码

代码语言:javascript
复制
     `webpack -d && copy src/index.html dist/index.html`
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53040176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档