• Register
0 votes
53 views

Problem :

I am trying to learn the Node JS. I have already installed my Node.JS (9.4.0) with the help of below commands.

$brew install node      
$node -v                                                             $v0.12.7

Then I executed below command

 npm install -g grunt-cli for test. But it gave me below error:

/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:28
        console.error(`a bug known to break npm. Please update to at least ${r
                      ^
SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
    at Module._compile (module.js:460:26)

How can I fix above error?

8 4 2
2,300 points

1 Answer

0 votes

Solution :

I have faced such issues in the past.

One of the cause of the issue is the incorrect path. You need to crosscheck your path.

It is possible that you are using the old version of Node JS which is not supporting the template litterels. So you can try to upgrade to the latest version of Node JS.

If above solutions are  not working for you then you should remove all the node/npm/gulp files from /usr/local area.

Then you should use "rpm -e" to remove all the nodejs packages and the npm

After that use below commands

yum install nodejs npm

npm install -g n

n 4.7.0

npm install -g gulp

It will fix your issue.

5 2 1
4,980 points

Related questions

0 votes
2 answers 370 views
370 views
Problem : I want to to run my NodeJS version with the nvm but getting following error: $ nvm use v4.2.4 nvm is not compatible with the npm config "prefix" option: currently set to "/Users/z/.npm-global"Run `npm config delete prefix` or `nvm use --delete- ... it. I have set the prefix on purpose to avoid the sudo npm How can I use nvm without losing the prefix for my globally installed packages?
asked Nov 29, 2019 alecxe 7.5k points
0 votes
1 answer 12 views
12 views
Problem: I am a beginner to node.js, cordova and npm.When I try below command: $ npm install -g cordova@latest I always face below error: &ldquo;Npm WARN deprecated node-uuid@1.4.8: Use uuid module instead.&rdquo; Below are my system details: mac Os Sierra 10.12 ... each and every suggestion and also tried to install or uninstall the hundred times. I want to know is it a npm or cordova problem?
asked Aug 29 Raphael Pacheco 4.9k points