[英]Accidentally deleted node_modules folder
I accidentally deleted my node_modules
folder. 我不小心删除了
node_modules
文件夹。 I know the way to get it back is just to run npm install
but this won't work in my case. 我知道取回它的方法只是运行
npm install
但是对我来说这是行不通的。 It's saying something's wrong in my JSON
file. 这是说我的
JSON
文件有问题。 I'm getting this error in Terminal
. 我在
Terminal
收到此错误。
Here's my Package.js
file: 这是我的
Package.js
文件:
{
"name": "App",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"aws-sdk": "git://github.com/aws/aws-sdk-js.git#react-native",
"react": "^16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-native-aws-signature": "0.0.9",
"react-native-dropdown-menu": "^1.1.0",
"react-native-dynamodb": "0.0.5",
"react-redux": "^5.0.5",
"redux": "^3.7.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.0.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
},
}
Error: 错误:
Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
There is an error on line 27, sufficient ,
here is a valid json 第27行有一个错误,足够了
,
这里是一个有效的json
{
"name": "TorusTApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"aws-sdk": "git://github.com/aws/aws-sdk-js.git#react-native",
"react": "^16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-native-aws-signature": "0.0.9",
"react-native-dropdown-menu": "^1.1.0",
"react-native-dynamodb": "0.0.5",
"react-redux": "^5.0.5",
"redux": "^3.7.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.0.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
我相信这是因为package.js文件中最后一行的末尾有一个逗号。
run this json through a json validator online. 通过JSON验证程序在线运行此JSON。 eg https://jsonlint.com/
例如https://jsonlint.com/
The previous answer was right but this should help you in the future. 先前的答案是正确的,但这将来会对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.