why protractor is getting installed in a different directory on mac m1 even after giving permission to /usr/local/lib/node_modules
austindarren opened this issue · comments
First error user@suser-Air / % npm install -g protractor
npm WARN deprecated request@2.88.2: request has been deprecated, see request/request#3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
Solution - I gave permission to the above path and ran again npm install -g protractor
Second error
user@suser-Air / % npm install -g protractor
npm WARN deprecated request@2.88.2: request has been deprecated, see request/request#3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/protractor/bin/protractor
npm ERR! dest /usr/local/bin/protractor
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/protractor/bin/protractor' -> '/usr/local/bin/protractor'
npm ERR! [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/protractor/bin/protractor' -> '/usr/local/bin/protractor'] {
npm ERR! cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/protractor/bin/protractor' -> '/usr/local/bin/protractor'] {
Node Version: 14.16.1
NPM version : '6.14.12'
Operating System and Version macOS Big Sur
I'd suggest avoiding to install Protractor globally (your project loses control over the version it uses) and treat it as a dev dependency instead:
npm install --save-dev protractor
To run the tests, add a test
script to your package.json
:
{
"scripts": {
"test": "protractor ./protractor.conf.js"
}
}
then invoke:
npm test
There are several template projects under https://github.com/serenity-js that use this pattern.
Hope this helps!
sudo npm install -g protractor worked for me. Thanks for you input.
will try this next time.