Tools: Running polymer init results in an error

Created on 11 Oct 2016  ·  11Comments  ·  Source: Polymer/tools

_From @Gespinha on October 7, 2016 20:6_

Hi there,

After installing polymer-cli and atempting to call polymer init, the following error is displayed:

$ polymer init
/usr/local/lib/node_modules/polymer-cli/bin/polymer.js:16
const resolve = require('resolve');
^^^^^
SyntaxError: Use of const in strict mode.
    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 Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

I have polymer-cli installed as a global package. Initially I thought I could have something wrong in my package folder. So I uninstalled all my npm modules and cleaned my npm cache, but nothing changed and I keep getting the same error.

Is this a known issue? Can anyone help me making polymer work?

_Copied from original issue: Polymer/polymer#4052_

cli

Most helpful comment

still broken not sure why this is marked as closed.

All 11 comments

_From @web-padawan on October 7, 2016 20:19_

Seems that you have node v 0.12 or older. If so, please install LTS (6.x) node.

_From @Gespinha on October 8, 2016 1:11_

@web-padawan I've managed to reconfigure homebrew's links to fix that issue, so I am now using node 6.7.0, but it now returns the following:

polymer init
-bash: polymer: command not found

Any clues on what is going wrong?

_From @web-padawan on October 8, 2016 5:4_

Now you need to run npm i -g polymer-cli again. Changing node version usually requires this for globally installed packages (because npm itself has been reinstalled).

_From @Gespinha on October 8, 2016 9:49_

@web-padawan Did that and it still doesn't work. Returns the same error: polymer: command not found

Thanks @kevinpschaaf

@Gespinha this seems like an issue with your command line PATH variable and not anything to do with the polymer-cli. Unfortunately there's nothing we can do on our end, but if you're using homebrew you might have some luck running brew doctor. If that doesn't help, I would recommend checking google / stack overflow.

Good luck!

@FredKSchott Hi, I have managed to solve this issue by uninstalling and completely reinstalling node and homebrew. Still don't know what caused the issue, but I might've done something wrong before that caused the node cask to unlink and break. Thanks for the help :)

Oof, homebrew path errors are the worst. Glad you got it figured out!

still broken not sure why this is marked as closed.

Try to run the install with sudo. It look like node does not have permission to write in /usr/local/bin

I exactly followed the steps mentioned in polymer-2.0 page but still stuck with command not found error.

[venkat@localhost bin]$ npm install -g polymer-cli
-> /home/venkat/.npm-global/lib/node_modules/polymer-cli/bin/polymer.js
/home/venkat/.npm-global/lib
└── [email protected] 

[venkat@localhost bin]$ polymer
bash: polymer: command not found...
[venkat@localhost bin]$ 

Finally it worked for me after using yarn.

yarn global add polymer-cli

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lpellegr picture lpellegr  ·  4Comments

stramel picture stramel  ·  4Comments

ronnyroeller picture ronnyroeller  ·  4Comments

emilbillberg picture emilbillberg  ·  3Comments

rictic picture rictic  ·  3Comments