Nodejs npm package | communication problem with npm

I am trying to make an npm package (plugin) for installing a small JS structure through node, also came up with the required package.json.

After running the npm link command on the Mac terminal, you will see the following errors.

npm ERR! Error: EACCES, symlink '/Repos/GIT/JavaScript-Boilerplate' npm ERR! { [Error: EACCES, symlink '/Repos/GIT/JavaScript-Boilerplate'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/Repos/GIT/JavaScript-Boilerplate' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 12.3.0 npm ERR! command "node" "/usr/local/bin/npm" "link" npm ERR! cwd /Repos/GIT/JavaScript-Boilerplate npm ERR! node -v v0.10.4 npm ERR! npm -v 1.2.18 npm ERR! path /Repos/GIT/JavaScript-Boilerplate npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, symlink '/Repos/GIT/JavaScript-Boilerplate' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Repos/GIT/JavaScript-Boilerplate/npm-debug.log npm ERR! not ok code 0 

PS I am new to nodejs but have a lot of experience with JavaScript, let me know if you need more details.

EDIT . To solve the problems listed above, now more problems arise, as shown below:

 6495 verbose false,/Repos/GIT/JavaScript-Boilerplate/node_modules,/Repos/GIT/JavaScript-Boilerplate/node_modules/jquery/node_modules unbuild contextify@0.1.5 6496 info postuninstall contextify@0.1.5 6497 verbose about to build /Repos/GIT/JavaScript-Boilerplate/node_modules/jquery 6498 info /Repos/GIT/JavaScript-Boilerplate/node_modules/jquery unbuild 6499 verbose from cache /Repos/GIT/JavaScript-Boilerplate/node_modules/jquery/package.json 6500 info preuninstall jquery@1.8.3 6501 info uninstall jquery@1.8.3 6502 verbose true,/Repos/GIT/JavaScript-Boilerplate/node_modules,/Repos/GIT/JavaScript-Boilerplate/node_modules unbuild jquery@1.8.3 6503 info postuninstall jquery@1.8.3 6504 error contextify@0.1.5 install: `node-gyp rebuild` 6504 error `sh "-c" "node-gyp rebuild"` failed with 1 6505 error Failed at the contextify@0.1.5 install script. 6505 error This is most likely a problem with the contextify package, 6505 error not with npm itself. 6505 error Tell the author that this fails on your system: 6505 error node-gyp rebuild 6505 error You can get their info via: 6505 error npm owner ls contextify 6505 error There is likely additional logging output above. 6506 error System Darwin 12.3.0 6507 error command "node" "/usr/local/bin/npm" "link" 6508 error cwd /Repos/GIT/JavaScript-Boilerplate 6509 error node -v v0.10.4 6510 error npm -v 1.2.18 6511 error code ELIFECYCLE 6512 verbose exit [ 1, true ] enter code here enter code here 

Looks like I'm close to that :)

+6
source share
3 answers

Hei!

Check out these lines!

  code EACCES (error acces like acces denied) & Please try running this command again as root/Administrator. ( acces denied ) 

try it with user with privileges.

or share this file: /Repos/GIT/JavaScript-Boilerplate/npm-debug.log

+2
source

The permissions that you used when installing Node will be necessary when performing operations such as writing to your npm directory ( npm link , npm install -g , etc.).

You may have run the Node installation as root, so installing the package globally requires you to be root.


Solution 1: NVM

Do not crack permissions, set Node to the correct path.

On the development machine, you must not install and run Node with root privileges, otherwise things like npm link , npm install -g will have the same permissions.

NVM (Node Version Manager) allows you to install Node without root privileges, and also allows you to install many versions of Node to play with them easily. Ideal for development.

  • Delete Node (may require root permission).
    • To remove all previously installed npm global modules, see the answers.
  • Then install the NVM following instructions on this page .
  • Install Node via NVM: nvm install stable

Now npm link , npm install -g will no longer require you to root.


Solution 2. Install packages worldwide for this user.

Don't crack permissions, install npm packages globally in the right way.

If you are on OSX or Linux, you can create a user-specific directory for your global package and configure npm and node to find out how to find globally installed packages.

Check out this great article for step-by-step instructions on installing npm modules worldwide without sudo.

See also: npm documentation on Fixing npm permissions .

+3
source

The easiest way to solve this problem is to run the same command again using sudo :

 sudo npm link 

Do not change the owner of the /usr/local directory, as this may lead to further consequences for the installed application and b) may compromise the security of your system. Using sudo is the right way to solve this problem.

+1
source

Source: https://habr.com/ru/post/944197/


All Articles