gpt4 book ai didi

npm - live-server 找不到指定的文件

转载 作者:行者123 更新时间:2023-12-04 21:17:24 25 4
gpt4 key购买 nike

我正在尝试设置一个 reactjs 项目并使用实时服务器。我的项目结构 -

fa/
-node-modules/
...
-public/
bundle.js
index.html
-src/
app.js
package.json

我的 package.json 文件 -
{
"name": "fa",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "watchify src/app.js -o public/bundle.js -t [ babelify --presets [ react es2015 ] ]",
"server": "cd public; live-server --port=1234 --entry-file=index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babelify": "^7.3.0",
"live-server": "^1.1.0",
"watchify": "^3.7.0"
}

}

我在一个 cmd 上运行“npm run build”,然后在另一个上运行“npm run server”。它给出了错误-
17 error Windows_NT 6.2.9200
18 error argv "E:\\Program Files\\nodejs\\node.exe" "E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "server"
19 error node v6.6.0
20 error npm v3.10.3`enter code here`
21 error code ELIFECYCLE
22 error fa@1.0.0 server: `cd public; live-server --port=1234 --entry-file=index.html`
22 error Exit status 1
23 error Failed at the fa@1.0.0 server script 'cd public; live-server --port=1234 --entry-file=index.html'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the fa package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error cd public; live-server --port=1234 --entry-file=index.html
23 error You can get information on how to open an issue for this project with:
23 error npm bugs fa
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls fa
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

我究竟做错了什么?

最佳答案

我知道这个问题很久以前就已经回答了。

真实答案正在更改以下内容:

"server": "cd public; live-server --port=1234 --entry-file=index.html"

到这个
"server": "cd public & live-server --port=1234 --entry-file=index.html"

就放 &

关于npm - live-server 找不到指定的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39578877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com