I am trying to install polymer-cli 2
$ install -g polymer-cli
gives EACCES: permission denied, mkdir
I am running Bash on Ubuntu On Windows (10) "As Administrator"/root
joebash@joethinks:~$ sudo su root
[sudo] password for joebash:
root@joethinks:/home/joebash# node --version
v7.10.1
root@joethinks:/home/joebash# git --version
git version 1.9.1
root@joethinks:/home/joebash# git --version
root@joethinks:/home/joebash# npm install -g bower
root@joethinks:/home/joebash# npm install -g polymer-cli
No error is thrown
root@joethinks:/home/joebash# git --version
git version 1.9.1
root@joethinks:/home/joebash# npm install -g bower
npm WARN deprecated [email protected]: ..psst! While Bower is maintained, we recommend Yarn and Webpack for *new* front-end projects! Yarn's advantage is se
curity and reliability, and Webpack's is support for both CommonJS and AMD projects. Currently there's no migration path, but please help to create it
: https://github.com/bower/bower/issues/2467
/usr/bin/bower -> /usr/lib/node_modules/bower/bin/bower
+ [email protected]
updated 1 package in 36.689s
root@joethinks:/home/joebash# npm install -g polymer-cli
npm WARN deprecated [email protected]: ..psst! While Bower is maintained, we recommend Yarn and Webpack for *new* front-end projects! Yarn's advantage is se
curity and reliability, and Webpack's is support for both CommonJS and AMD projects. Currently there's no migration path but we hope you'll help us fi
gure out one.
npm WARN deprecated @types/[email protected]: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
/usr/bin/polymer -> /usr/lib/node_modules/polymer-cli/bin/polymer.js
> [email protected] install /usr/lib/node_modules/polymer-cli/node_modules/wd
> node scripts/build-browser-scripts
/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
at Object.fs.mkdirSync (fs.js:895:18)
at sync (/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
at Object.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/build-browser-scripts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-07-29T18_03_53_599Z-debug.log
root@joethinks:/home/joebash#
Consider using nvm to handle permissions properly and easily upgrade to new node versions.
Also, lot of issues like this have already been submitted here, but none of them is related to polymer-cli itself.
I'm using WSL (like you) and don't have these issues, likely because I'm using nvm. I never use root either.
What is the status on this? I'm also experiencing the same problem.
As details in the NPM issue linked above, the problem is a regression in NPM and can be also worked around by setting --unsafe-perm
Closing per above comment. Thanks @guss77 for the update!
this issue was resolved through this command :
muhssin@muhssin:~$ ~/node_modules/polymer-cli/bin/polymer.js
/\˜˜/ /\˜˜/\
/__\/ /__\/__\ Polymer-CLI
/\ / /\ /\ /\
/__\/ /__\/ \/__\ The multi-tool for Polymer projects
\ /\ /\ / /\ /
\/__\/__\/ /__\/ Usage: polymer <command> [options ...]
\ /\ / /\ /
\/__\/ /__\/
Available Commands
analyze Writes analysis metadata in JSON format to standard out
build Builds an application-style project
help Shows this help message, or help for a specific command
init Initializes a Polymer project
install installs Bower dependencies, optionally installing "variants"
lint Identifies potential errors in your code.
serve Runs the polyserve development server
test Runs web-component-tester
Global Options
--env type The environment to use to specialize certain
commands, like build
--entrypoint The main HTML file that will be requested for
all routes.
--shell string The app shell HTML import
--fragment string[] HTML imports that are loaded on-demand.
--root string The root directory of your project. Defaults
to the current working directory.
--sources string[] Glob(s) that match your project source files.
Defaults to src/**/*.
--extra-dependencies string[] Glob(s) that match any additional
dependencies not caught by the analyzer to
include with your build.
-v, --verbose turn on debugging output
-h, --help print out helpful usage information
-q, --quiet silence output
Run polymer help <command> for help with a specific command.
For others having this issue, you can run npm install -g npm@4 to downgrade npm to version 4 which will circumvent this issue. Quite annoying to do this, hopefully the npm team will fix this regression soon.
Had the same issue, @z2oh solution solved it.
Alternatively, you can use yarn to install polymer with sudo yarn global add polymer-cli until its fixed in the latest version of npm.
Weird, npm gave me same error. if npm is no good why list it in polymer-cli setup guide? who has days to troubleshoot the setup
Also encountered this issue under Linux Mint 19. Thankfully was able to get around it with @guss77 's comment. However, this isn't strictly an npm issue... This is the error I got in one of it's forms Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
and yes --unsafe-perm gets around it but.....
root@linux:/# mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build/'
mkdir: cannot create directory ‘/usr/lib/node_modules/polymer-cli/node_modules/wd/build/’: No such file or directory
I can't execute mkdir directly to create this folder path anyway... So I would strongly recommend that the scripts be modified to break down the creation of the file paths into steps like so
mkdir '/usr/lib/node_modules/'
mkdir '/usr/lib/node_modules/polymer-cli/'
mkdir '/usr/lib/node_modules/polymer-cli/node_modules/'
mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/'
mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build/'
This is stupid hacky but apparently, when creating folder structures this deep it's necessary now.... whether this is still technically an npm issue or a polymer-cli issue...... :man_shrugging:
@azariah001 You can use the -p flag with mkdir to create all necessary parent directories at once, eg.
mkdir -p long/path/at/once
The cause of this issue is that your current user doesn't have the proper access to execute and write in the required directory.
When you install node without using something like nvm the permissions are often not set up properly, so you have to set the owner and file permissions manually, if you do this error should cease to exist.
You can look up node's documentation for help with setting the proper file permissions.
Thanks @guss77 , i was stuck there too! thanks for pointing out !
Most helpful comment
As details in the NPM issue linked above, the problem is a regression in NPM and can be also worked around by setting
--unsafe-perm