Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrian Patterson
19,588 PointsGetting an error in console when running scripts.
I am getting the following error when running the scripts.
➜ taskRunner npm run copy-files
npm ERR! file /Users/briankaty1/Dropbox/JavaScript/taskRunner/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token
npm ERR! in JSON at position 211 while parsing '{
npm ERR! "name": "dice_simulator_2015",
npm ERR! "ve'
npm ERR! File: /Users/briankaty1/Dropbox/JavaScript/taskRunner/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! Tell the package author to fix their package.json file. JSON.parse
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/briankaty1/.npm/_logs/2018-02-23T16_27_17_508Z-debug.log
This is my package.json file.
{
"name": "dice_simulator_2015",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"uglify": "uglifyjs src/models/* src/frontend.js -m
-c -o build/app.js",
"copy-files": "cp src/*.html build/ & cp src/*.css build/"
},
"keywords": [
"dice"
],
"author": "Brian Patterson",
"license": "MIT"
}
Not sure what I am doing wrong.
1 Answer
Romain Gaget
24,449 Pointsit seems to be a carriage return on the uglify property that causing the problem.Try to paste you json in this json validator https://jsonlint.com/.
Instead of
"uglify": "uglifyjs src/models/* src/frontend.js -m
-c -o build/app.js",
try
"uglify": "uglifyjs src/models/* src/frontend.js -m-c -o build/app.js",
Brian Patterson
19,588 PointsBrian Patterson
19,588 PointsNo that does not work. I am now getting this error.
This is what I get when I run npm run build
Mike Hatch
14,940 PointsMike Hatch
14,940 PointsThanks Romain. Brian, this was the actual issue and Romain solved it. There is no space between the
-m
and the-c
. This is exactly what was happening to me as well. A possible bug issue with Workspace? That is one awefully ugly long line of code as it is. No wonder it's calleduglify
! Yuck.