Npm ERR! Error: EPERM, chmod

If you encounter problems using npm on my raspberry pi when trying to create a node.js application on a USB device.

package.json is as follows:

{ "name" : "node-todo", "version" : "1.0.0", "description" : "TodoApp", "main" : "server.js", "autho" : "Stephan", "dependencies" : { "express" : "*" } } 

Using npm installation results:

 npm WARN package.json node-todo@1.0.0 No repository field. npm WARN package.json node-todo@1.0.0 No README data npm http GET https://registry.npmjs.org/express npm http 304 https://registry.npmjs.org/express npm ERR! Error: EPERM, chmod '/media/ServerHD/testraum/test/node_modules/express/package.json' npm ERR! { [Error: EPERM, chmod '/media/ServerHD/testraum/test/node_modules/express/package.json'] npm ERR! errno: 50, npm ERR! code: 'EPERM', npm ERR! path: '/media/ServerHD/testraum/test/node_modules/express/package.json', npm ERR! fstream_finish_call: 'chmod', npm ERR! fstream_type: 'File', npm ERR! fstream_path: '/media/ServerHD/testraum/test/node_modules/express/package.json', npm ERR! fstream_class: 'FileWriter', npm ERR! fstream_stack: npm ERR! [ '/opt/node/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19', npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Linux 3.12.28+ npm ERR! command "/opt/node/bin/node" "/opt/node/bin/npm" "install" "-no-bin-links" npm ERR! cwd /media/ServerHD/testraum/test npm ERR! node -v v0.10.28 npm ERR! npm -v 1.4.9 npm ERR! path /media/ServerHD/testraum/test/node_modules/express/package.json npm ERR! fstream_path /media/ServerHD/testraum/test/node_modules/express/package.json npm ERR! fstream_type File npm ERR! fstream_class FileWriter npm ERR! fstream_finish_call chmod npm ERR! code EPERM npm ERR! errno 50 npm ERR! stack Error: EPERM, chmod '/media/ServerHD/testraum/test/node_modules/express/package.json' npm ERR! fstream_stack /opt/node/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /media/ServerHD/testraum/test/npm-debug.log npm ERR! not ok code 0 

If I try to run npm install in / home / myUser / Appfolder, everything works fine. All files on the ServerHD server are created by the same user to which the home folder belongs. I tried using:

  • npm install -no-bin-links, which leads to the same problems
  • an attempt to change the folder on ServerHD to 777 has no effect for npm
  • trying to run npm install using sudo

Using an express generator causes simulation problems.

Hope someone can help. Thanks, bye.

+6
source share
3 answers

I had a similar error and call:

npm cache clean

Helped me solve this problem.

+6
source

npm tells you that you do not have enough permissions to change file permissions. This is probably a race condition, some of which were recorded in the code base npm@1.4 . I guess that the reason you see this on one drive and not on another is that the drives have different latencies and read access times, causing irreparable behavior.

You should upgrade to the current version of npm (and node, for that matter). If you are using a Debian based distribution, you can follow the instructions here < https://github.com/nodesource/distributions#usage-instructions >

curl -sL https://deb.nodesource.com/setup | sudo bash - sudo apt-get install -y nodejs nodejs-legacy sudo npm -g install npm@latest

If this does not fix your problem, let me know; for a quicker answer, create a problem in npm tracker https://github.com/npm/npm/issues and tag me (@smikes) in the problem.

+2
source

copy the gruntfile and package.json file to the local computer. Install npm here. Transfer the result of node_modules to a USB device. It works for me. The easiest way, I think.

0
source

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


All Articles