Loading a package after git clone fails


#1

I tried to modify a package on which the original author is inactive for long in order to implement what I want. I first did the following.

$ apm disable language-latex
$ cd ~/work/atom
$ git clone git@github.com:area/language-latex.git
$ mv language-latex language-tex
$ cd language-tex
# edit package.json to initialize as a new package
$ git diff package.json
diff --git a/package.json b/package.json
index 60b6c78..c1d38dd 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
 {
-  "name": "language-latex",
-  "version": "0.6.1",
+  "name": "language-tex",
+  "version": "0.1.0",
   "private": true,
-  "description": "Syntax highlighting for LaTeX for Atom",
+  "description": "Atom syntax highlight for TeX and its major macro packages",
   "repository": "https://github.com/area/language-latex",
   "license": "MIT",
   "engines": {
$ apm link .

Then, I invoked Atom and it said “Failed to load the language-tex package” with a message below.

Unexpected string in /Users/yudai-nkt/.atom/package
s/language-tex/package.json

SyntaxError: Unexpected string
    at Object.parse (native)
    at parseObject (/Applications/Atom.app/Contents
/Resources/app.asar/node_modules/season/lib/cson.js
:54:19)
    at parseContentsSync (/Applications/Atom.app/Co
ntents/Resources/app.asar/node_modules/season/lib/c
son.js:68:16)
    at Object.module.exports.readFileSync (/Applica
tions/Atom.app/Contents/Resources/app.asar/node_mod
ules/season/lib/cson.js:170:14)
    at PackageManager.module.exports.PackageManager
.loadPackageMetadata (/Applications/Atom.app/Conten
ts/Resources/app.asar/src/package-manager.js:700:29
)
    at PackageManager.module.exports.PackageManager
.loadPackage (/Applications/Atom.app/Contents/Resou
rces/app.asar/src/package-manager.js:423:36)
    at /Applications/Atom.app/Contents/Resources/ap
p.asar/src/package-manager.js:402:19
    at Config.module.exports.Config.transact (/Appl
ications/Atom.app/Contents/Resources/app.asar/src/c
onfig.js:312:16)
    at PackageManager.module.exports.PackageManager
.loadPackages (/Applications/Atom.app/Contents/Reso
urces/app.asar/src/package-manager.js:397:19)
    at /Applications/Atom.app/Contents/Resources/ap
p.asar/src/atom-environment.js:743:28
  at /Users/yudai-nkt/.atom/packages/language-tex/p
ackage.json:1:1

I guess the last line’s at /Users/yudai-nkt/.atom/packages/language-tex/package.json:1:1 is saying the first character of the first line of language-tex's package.json triggers the error, but I didn’t edit that place as you can see in the result of git diff package.json. I have no idea about the rest of the log neither.

How can I load my language-tex successfully and move on to the tweak?

Note that my environment is as follows:

  • OS: OS X El Capitan 10.11.4
  • Atom: Version 1.8.0

#2

Rather than show a diff, could you show the actual contents of the package.json file? It would make diagnosing things a lot easier :grinning:


#3

Sorry for the insufficient information (I intended to state I didn’t do anything wierd by showing the diff). Anyway, the whole package.json is:

{
  "name": "language-tex",
  "version": "0.1.0",
  "private": true,
  "description": "Atom syntax highlight for TeX and its major macro packages",
  "repository": "https://github.com/area/language-latex",
  "license": "MIT",
  "engines": {
  "atom": ">0.50.0"
  },
  "dependencies": {}
}
"keywords": [
    "latex",
  ],


#4

It’s malformed because you have the dangling:

"keywords": [
    "latex",
  ],

at the end. If you delete that for now, it should work ok.


#5

It settles the problem and I can also include the keyword(s) entry inside the brace, thakns. I now wonder why the original has such kind of bad json file though.