I tried installing gulp via cmd on my mac but and used
nmp install gulp-cli --global
but couldn't install, instead it throws a permission denied error as show in the image below. Any suggestions?
http://i.stack.imgur.com/dO91r.png
It's all about permission problem. You can try,
sudo npm install -g gulp-cli--global --allow-root
Related
I am trying to install npm install -g json-server on mac OS, but it is showing error. Any recommendation. What I need to change ?
Try adding 'sudo' at the beginning.
sudo npm install -g json-server
then enter admin password to begin install.
Whenever your command is not.
Use "sudo" before code.
Ex: npm install -g json-server
Use: sudo npm install -g json-server
Sudo "forces" installation or in other words, sudo is admin.
I am trying to deploy my functions on the cloud functions emulator but my terminal throws me this error:
$ functions deploy sendNotifications --trigger-http
{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/#google-cloud/functions-emulator/logs'
at Error (native)
at Object.fs.mkdirSync (fs.js:922:18)
at Object.assertLogsPath (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/emulator/logs.js:31:10)
at new Controller (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/controller.js:84:32)
at Object.exports.handler (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/commands/deploy.js:124:22)
at Object.self.runCommand (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/lib/command.js:231:22)
at Object.Yargs.self._parseArgs (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/yargs.js:989:30)
at Object.Yargs.self.parse (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/yargs.js:533:23)
at Object.main (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/main.js:69:6)
at getProjectId.then (/usr/local/lib/node_modules/#google-cloud/functions-emulator/bin/functions:100:27)
errno: -13, code: 'EACCES', syscall: 'mkdir', path:
'/usr/local/lib/node_modules/#google-cloud/functions-emulator/logs' }
I have cd-ed to the functions directory and checked that I am logged in to firebase and selected the right project Id. Am i doing something wrongly?
Overview
The proper way to fix this is by changing the npm global directory to one that does not require root permission to install and run.
You really should not be requiring sudo to npm install -g.
Likewise to functions start.
Cleansing
Given that you have installed functions, presumably using sudo npm install -g #google-cloud/functions-emulator, you now need to first uninstall it equally with sudo: sudo npm uninstall -g #google-cloud/functions-emulator.
Why uninstall it? You currently have functions installed into a directory where root permissions are required to write. It does require write permission to log file as you can see from the error.
I would suggest uninstalling the other npm packages which you may have installed using sudo, except npm. You can find out what you have using sudo npm list -g --depth=0.
Changing npm global directory
I would suggest going with Option 2 described on https://docs.npmjs.com/getting-started/fixing-npm-permissions
Copy pasting solution from link above:
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Install global without sudo
Now that your machine has been cleansed and npm global has been configured to a directory that does not require root permissions, you should be able to install and run without sudo.
Had the same issue. For me it did not showed the permission log also..The issues is with the permissions. Try to the command with super user.
Step 1.
Start the gcloud functions
sudo functions start
Step 2.
Deploy the helloworld function which was exported.
sudo functions deploy helloworld --trigger-http
This is obviously very late for the original post. Hope this helps other who has the same error in the future.
I had the same issue turn out I hadn't installed that the requirements properly. Any one who steps in here can look at Error: EACCES: permission denied #195.
Main note of this error install all requirements properly.
I am installing PM2 for hubot rocket.chat adapter. so i did the following:
I firstly added a file to hubot adapter folder, then
sudo npm install pm2 -g
cd <hubot directory>
pm2 start <pm2.json>
The i got error saying this:
No command 'pm2' found, did you mean:
Command 'wm2' from package 'wm2' (universe)
Command 'pms' from package 'pms' (universe)
Command 'pmk' from package 'pmk' (universe)
Command 'pmw' from package 'pmw' (universe)
Command 'fpm2' from package 'fpm2' (universe)
Command 'pom2' from package 'libpod-pom-perl' (universe)
Command 'pmi' from package 'powermanagement-interface' (universe)
Command 'pm' from package 'powerman' (universe)
pm2: command not found
Then I tried to add the path by doing:
sudo env PATH=$PATH:/home/jy/.npm-global/bin pm2 startup -u safeuser
and
export PATH=$PATH:/home/jy/.npm-global/bin
and restarted PuTTY,
still get the same error.
when I went to where PM2 is at, which is /home/jy/.npm-global/bin, and do pm2 start <pm2.json> command, still get the same error.
Is there anything i did wrong? or there might be other reasons?
The problem is that you are running NPM as sudo, so you will only be able to access it using:
sudo pm2 start server.js
Install without sudo, you may even install without the -g flag and call it directly from node_modules directory. This may be useful if you do not have root (admin) privileges in the machine you're working on.
npm install pm2
./node_modules/.bin/pm2 start server.js
Source: https://stackoverflow.com/a/40812333/1052581
bower EACCES EACCES: permission denied, open '/home/caner/.cache/bower/packages/e5ec1b46386aa59c822f27e340f7ab5b-1.5.8.lock'
Stack trace:
Error: EACCES: permission denied, open '/home/caner/.cache/bower/packages/e5ec1b46386aa59c822f27e340f7ab5b-1.5.8.lock'
at Error (native)
Console trace:
Error
at StandardRenderer.error (/home/caner/.npm-global/lib/node_modules/bower/lib/renderers/StandardRenderer.js:81:37)
at Logger.<anonymous> (/home/caner/.npm-global/lib/node_modules/bower/lib/bin/bower.js:110:26)
at emitOne (events.js:90:13)
at Logger.emit (events.js:182:7)
at Logger.emit (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
at /home/caner/.npm-global/lib/node_modules/bower/lib/commands/index.js:48:20
at _rejected (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:844:24)
at /home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:870:30
at Promise.when (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:788:41)
System info:
Bower version: 1.7.9
Node version: 5.12.0
OS: Linux 4.4.0-38-generic x64
i got this error when i try to install bower with
bower pdate
i tried lots of things.
bower init
chown
but did not work
i first installed npm then try to install bower.
i did most of those
https://www.google.com.tr/search?q=Error%3A+EACCES%3A+permission+denied%2C+open+%27%2F%2Fbower-github.json%27&oq=Error%3A+EACCES%3A+permission+denied%2C+open+%27%2F%2Fbower-github.json%27&aqs=chrome..69i57j69i58.3505j0j4&sourceid=chrome&ie=UTF-8
but not working.
what can be reason?
what i want to do is
npm install
npm install -g bower (no need if you have installed bower)
bower install
bower prune
bower update
npm install -g gulp (no need if you have installed gulp)
gulp install
in a project directory
Remove .cache folder first, I guess that .cache folder created with different permissions, it happens when You play with sudo and etc.
So run this:
sudo rm -rf /home/caner/.cache
and after that run Your commands again
Trying to test compoundjs with mysql but it fails.
My system is Debian 7 with following versions of nodejs & npm
$ node -v
v0.10.13
$ npm -v
1.3.4
Here is how I installed compoundjs
sudo npm install -g compound
sudo npm install -g jugglingdb --save
sudo npm install -g jugglingdb-mysql
compound init testapp --db mysql
cd testapp
npm install
$ node server.js
WARNING: JugglingDB adapter "mysql" is not installed,
so your models would not work, to fix run:
npm install jugglingdb-mysql
/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55
if (!schema.adapter) throw new Error('Adapter is not defined');
^
Error: Adapter is not defined
at init (/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55:36)
at CompoundServer.initialize (/srv/www/playground/node/testapp/node_modules/jugglingdb/index.js:31:19)
at CompoundServer.EventEmitter.emit (events.js:98:17)
at CompoundServer.initCompound (/srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:123:14)
at CompoundServer.initCompoundServer [as init] (/srv/www/playground/node/testapp/node_modules/compound/lib/server/compound.js:53:29)
at /srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:67:18
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:901:3
After getting the error above I tried
npm install jugglingdb-mysql
I still get the same error. I have tried installing jugglingdb and jugglingdb-mysql globally and locally (without -g). I keep getting the same error.
The bug is due to the jugglingdb version used in the npm deposit of jugglingdb-mysql, so the only way to fix it is to delete the directory and copy the one you use in your main project :
cd $YOUR_PROJECT_ROOT
rm -rf node_modules/jugglingdb-mysql/node_modules/jugglingdb
cp -R node_modules/jugglingdb node_modules/jugglingdb-mysql/node_modules
I haven't tries to install the adapter manually from github, maybe it works too.
The problem is reported here https://github.com/jugglingdb/mysql-adapter/issues/46