使用npx create-react-app testapp
创建新的ReactJS应用程序后,命令npm start
(或任何其他npm-script)在我的任何React项目中均无效。它不会向控制台提供任何输出,并且~/.npm/_logs/
中的日志文件与start
命令没有任何关系。
我尝试过的事情:
package-lock.json
和node_modules/
并运行npm install
(效果很好,但不能用npm start
解决问题)5.3.12-arch1-1
)其他信息:
node -v
= 13.3.0
npm -v
= 16.13.1
这是最近创建的应用中的package.json
:
{
"name": "react-frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.0"
},
"scripts": {
"start": "react-scripts start",
"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"
]
}
}
答案 0 :(得分:1)
找到了解决方案。 npm
已配置为忽略脚本。
运行npm config set ignore-scripts false
解决了该问题。