我正试图用Netlify托管我的react应用程序,但当我运行npm run build时,我出现了以下错误
npm ERR! missing script: build
这是我的package.json文件
"name": "client",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:5000",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
我该如何解决?
Netlify运行npm
时,在package.json
中找不到run
命令,很可能是因为它位于错误的目录中。
您的package.json
需要位于Netlify配置中的Base目录中。