Node.js 如何使npm在克隆的React存储库上开始工作?
我已经创建了一个新的github存储库,其中包含从我的另一个github存储库下载的工作项目中的文件。我已经运行了Node.js 如何使npm在克隆的React存储库上开始工作?,node.js,reactjs,git,npm,Node.js,Reactjs,Git,Npm,我已经创建了一个新的github存储库,其中包含从我的另一个github存储库下载的工作项目中的文件。我已经运行了npm安装。当我尝试npm start时,出现以下错误: npm ERR! missing script: start npm ERR! A complete log of this run can be found in: npm ERR! /home/mycomputername/.npm/_logs/2020-03-22T17_16_37_070Z-debug.log
npm安装
。当我尝试npm start
时,出现以下错误:
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mycomputername/.npm/_logs/2020-03-22T17_16_37_070Z-debug.log
我在其他帖子中读到,问题可能出在“scripts”、“start”package.json文件中。这就是我的样子:
{
"name": "myproject",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap-4-grid": "^3.2.0",
"formik": "^2.1.4",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"react-spring": "^8.0.27",
"use-places-autocomplete": "^0.5.4",
"yup": "^0.28.1"
},
"scripts": {
"start": "react-scripts start", //supposedly problematic
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
我已尝试将开始脚本更改为“start”:“index.js”
或“start”:“App.js”
,因为它们是我的主文件,但我不知道我是否做了正确的事情
如果我运行npm run
这就是我得到的结果
Lifecycle scripts included in mycomputername:
test
echo "Error: no test specified" && exit 1
| npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /home/mycomputername/.config |
此外,此存储库将与其他人共享--他们从我的存储库克隆时是否会遇到同样的问题?根据您发布的内容,这应该是可行的。请尝试
npm run
查看它正在接收哪些脚本。您是否与此项目位于同一目录中?我是在运行mycomputername:test echo“Error:no test specified”中包含的npm run生命周期脚本和退出1后得到此消息的。我认为您从错误目录运行npm命令。您显示的package.json包含所有脚本(包括start),但npm run
仅将测试显示为可用脚本。根据您发布的内容,这应该可以工作。请尝试npm run
查看它正在接收哪些脚本。您是否与此项目位于同一目录中?我是在运行mycomputername:test echo“Error:no test specified”中包含的npm run生命周期脚本和退出1后得到此消息的。我认为您从错误目录运行npm命令。您显示的package.json包含所有脚本(包括start),但npm run
仅将测试显示为可用脚本。