grunt Unexpected token : error

落爺英雄遲暮 提交于 2020-01-03 05:52:53

问题


I followed http://gruntjs.com/getting-started to install grunt on my Ubuntu 11.10. When I ran grunt, I got this error:

/opt/node-v0.10.0-linux-x64/lib/node_modules/grunt-cli/package.json:2
  "name": "grunt-cli",
        ^

node.js:134
    throw e; // process.nextTick error, or 'error' event on first tick
    ^
SyntaxError: Unexpected token :
    at Module._compile (module.js:397:25)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)
    at require (module.js:346:19)
    at Object.<anonymous> (/opt/node-v0.10.0-linux-x64/lib/node_modules/grunt-cli/lib/info.js:13:11)
    at Module._compile (module.js:402:26)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)

I previously used grunt 0.3.16. I am upgrading to the latest grunt. It doesn't seem to be related to my project. I get this error in any directory.


回答1:


It turns out I didn't install node.js correctly. I simply untar the node.js binary and added it to my path. I guess that is why it didn't work. I download the node.js source, compiled and installed it using make, and it works now. Thanks for all your comments.



来源:https://stackoverflow.com/questions/15375140/grunt-unexpected-token-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!