I’m trying to run npm install
and I get this:
root@WF-DEV1:/var/www/laravel# npm install
npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected token }
npm ERR! File: /var/www/laravel/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
This is my package.json
file:
{
"name": "bootstrap-tagsinput",
"title": "Bootstrap Tags Input",
"version": "0.5.0",
"description": "jQuery plugin providing a Twitter Bootstrap user interface for managing tags.",
"scripts": {
"test": "karma start --single-run --no-auto-watch"
},
"main" : "dist/bootstrap-tagsinput.js",
"repository": {
"type": "git",
"url": "git://github.com/timschlechter/bootstrap-tagsinput.git"
},
"author": "Tim Schlechter",
"contributors": [{
"name": "Luckner Jr Jean-Baptiste"
}],
"license": "MIT",
"homepage": "http://timschlechter.github.io/bootstrap-tagsinput/examples/",
"download": "http://timschlechter.github.io/bootstrap-tagsinput/build/bootstrap-tagsinput.zip",
"keywords": [
"tags",
"bootstrap",
"input",
"select",
"form"
],
"readmeFilename": "README.md",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.13",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-jquerymanifest": "~0.1.4",
"grunt-zip": "~0.15.0",
"karma": "~0.12.19",
"phantomjs": "~1.9.7-15",
"karma-phantomjs-launcher": "~0.1.3",
"karma-jasmine": "~0.1.5",
"grunt-karma": "~0.8.3",
"bower": "~1.3.8",
"grunt-bower-task": "~0.4.0"
},
"banner": "/*n * <%= pkg.name %> v<%= pkg.version %> by <%= pkg.author %>n * <%= pkg.license.url %>n */n"
}
Any help would be appreciated!
2
Answers
For some reason, the wrong code was in my package.json. Not sure how it got there but I definitely didn't put it there. I reinstalled everything and it's now fixed and the right code is in there now.
The JSON appears to be valid (I ran it through an online parser). I ran the same
package.json
under windows and got the following output:The
npm-debug.log
started with:So on a hunch, I changed your
devDependencies
todependencies
and that worked. So I don’t have a firm answer, but it seems there is definitely something in your file that npm has a problem with – it’s just not a JSON error.