我正在尝试在我的本地运行一个项目。我在我的计算机上安装了npm和nodejs并尝试设置项目。
当我第一次运行npm install
时出现问题。
错误消息是:
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/home/aaa/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! file /home/aaa/.npm/asynckit/0.4.0/package/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: /home/aaa/.npm/asynckit/0.4.0/package/package.json
npm ERR! 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
我的package.json文件是:
```
{
"name": "babel-with-gulp",
"version": "1.0.0",
"description": "Starter code for using Babel with Gulp",
"main": "index.js",
"scripts": {
"test": "jest",
"start": "gulp watch"
},
"author": "Carlos Souza <carloshrsouza@gmail.com> (http://csouza.me/)",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/codeschool/babel-with-gulp.git"
},
"keywords": [
"babel",
"gulp",
"es2015"
],
"bugs": {
"url": "https://github.com/codeschool/babel-with-gulp/issues"
},
"homepage": "https://github.com/codeschool/babel-with-gulp#readme",
"devDependencies": {
"babel-core": "^6.7.6",
"babel-jest": "^15.0.0",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-1": "^6.13.0",
"babel-register": "^6.7.2",
"babelify": "^7.2.0",
"browser-sync": "^2.11.2",
"browserify": "^12.0.1",
"eslint": "^2.7.0",
"eslint-plugin-react": "^4.2.3",
"exorcist": "^0.4.0",
"gulp": "^3.9.0",
"gulp-eslint": "^2.0.0",
"gulp-if-else": "^1.0.3",
"gulp-imagemin": "^3.0.3",
"gulp-uglify": "^1.5.3",
"jest": "^15.1.1",
"jquery": "^2.2.2",
"react": "^15.0.1",
"react-dom": "^15.0.1",
"react-router": "^2.7.0",
"react-test-renderer": "^15.3.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
},
"dependencies": {
"immutable": "^3.8.1",
"material-ui": "^0.15.4",
"react-addons-css-transition-group": "^15.3.1",
"react-bootstrap": "^0.30.3",
"react-player": "^0.9.0",
"react-redux": "^4.4.5",
"react-tap-event-plugin": "^1.0.0",
"redux": "^3.6.0"
}
}
``` 我错过了运行代码的任何先决条件吗?或者是否存在兼容性问题?我有节点(4.4.5)版本和npm(2.15.5)。
答案 0 :(得分:0)
首先使用npm cache clean
清理缓存,然后您可以毫无错误地运行该命令。