• Register
0 votes

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:

        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

Please log in or register to answer this question.

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
1 answer 116 views
0 votes
2 answers 512 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 23 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, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 60 views
Problem: I am very desperately trying to install the modules using node.js but it always fails while getting the packages with npm. I was logged in as Administrator and then used powershell/cmd with a "run as administrator". I also had problems with a registry so I ... error: Npm ERR! Please try running this command again as root/Administrator. Can someone help me in fixing my above NPM error.
asked Aug 31, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 114 views
In one of my jenkins environment build has started failing, while in local machine it seems to be working fine as i have python installed, From the logs i was able to detect that the problem is with internal dependency that is node-gyp v3.5.0 from node-sass v3.8.0 when i ... node -v v5.10.1 gyp ERR! node-gyp -v v3.5.0 gyp ERR! not ok Build failed Any thoughts are much appreciated, Thanks.
asked Oct 27, 2020 psandprop 2.4k points
0 votes
2 answers 69 views
On trying to run the command below there show some errors. $ gulp build In my terminal and I get this assertion error. I've uninstalled node and NPM and reinstalled again using brew - How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) with these steps. My ... /**/*'], [panini.refresh]); }); // Erases the dist folder gulp.task('reset', function() { rimraf('bulma/*');
asked Oct 30, 2020 psandprop 2.4k points
1 vote
1 answer 40 views
Problem: I have gained fundamental knowledge on Angular2. I am taking help of online tutorials to learn Angular2. I am trying to create the angular 2 App with the angular cli I have written below command in my cmd: npm install angular-cli -g After above command I am ... an error . I am unable to debug above error. I need Angular2 expert who can help me in fixing above Angular2 error for me.
asked Jun 5, 2020 Martin K 6.6k points
0 votes
1 answer 698 views
Problem : I am new to npm and now I am facing strange looking below error &ldquo;Error: EACCES: permission denied, access '/usr/local/lib/node_modules'&rdquo; Detailed error as below: npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ... code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } Have somebody fixed this before?
asked Feb 20, 2020 mphil 2.3k points