Syntax Error while installing node modules via npm install

(Harshita) #1

I am trying to install node modules via npm install, ideally it should install and add an entry in my package.json. it just throws an error when I try to install

npm install --save packagename
npm ERR! Invalid or unexpected token

when I run
node -v

npm -v

Platform Info

$ npm --versions
{ nodejsprojectstructure: '0.0.0',
  npm: '6.4.1',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.12.0',
  openssl: '1.0.2p',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.2',
  v8: '6.2.414.66',
  zlib: '1.2.11' }
$ node -p process.platform