opencv4nodejs icon indicating copy to clipboard operation
opencv4nodejs copied to clipboard

ERR! Error: Command failed: mkdir -p opencv

Open demiton opened this issue 8 years ago • 4 comments

Hello, I tried to install the library on debian Jessie with this command :

sudo npm install --save opencv4nodejs --verbose

but it failed, I get this error :

ERR! Error: Command failed: mkdir -p opencv
mkdir: cannot create directory ‘opencv’: Permission denied

I have already installed opencv, when I check my version, I get :

>>> import cv2
>>> cv2.__version__
'3.2.0'

and I use npm 6.4.1 and node v8.12.10 Is it a version issue ? The message says that the permission is denied but I start the installation with "sudo" rights...

Here is the complete log message :

vagrant@jessie:~/git/opencv4Node$ sudo npm install --save opencv4nodejs --verbose                                                     
npm info it worked if it ends with ok                                                                                                 
npm verb cli [ '/usr/bin/node',                                                                                                       
npm verb cli   '/usr/bin/npm',                                                                                                        
npm verb cli   'install',                                                                                                             
npm verb cli   '--save',                                                                                                              
npm verb cli   'opencv4nodejs',                                                                                                       
npm verb cli   '--verbose' ]                                                                                                          
npm info using [email protected]                                                                                                              
npm info using [email protected]                                                                                                           
npm verb npm-session 6aff36ec11df5dce                                                                                                 
npm http fetch GET 200 https://registry.npmjs.org/opencv4nodejs 18ms (from cache)                                                     
npm timing stage:loadCurrentTree Completed in 230ms                                                                                   
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms                                                                      
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 3ms                                                                        
npm http fetch GET 200 https://registry.npmjs.org/opencv-build 12ms (from cache)                                                      
npm http fetch GET 200 https://registry.npmjs.org/npmlog 7ms (from cache)                                                             
npm http fetch GET 200 https://registry.npmjs.org/are-we-there-yet 31ms (from cache)                                                  
npm http fetch GET 200 https://registry.npmjs.org/console-control-strings 32ms (from cache)                                           
npm http fetch GET 200 https://registry.npmjs.org/set-blocking 31ms (from cache)                                                      
npm http fetch GET 200 https://registry.npmjs.org/gauge 33ms (from cache)                                                             
npm http fetch GET 200 https://registry.npmjs.org/delegates 8ms (from cache)                                                          
npm http fetch GET 200 https://registry.npmjs.org/readable-stream 10ms (from cache)                                                   
npm http fetch GET 200 https://registry.npmjs.org/core-util-is 15ms (from cache)                                                      
npm http fetch GET 200 https://registry.npmjs.org/inherits 14ms (from cache)                                                          
npm http fetch GET 200 https://registry.npmjs.org/isarray 12ms (from cache)                                                           
npm http fetch GET 200 https://registry.npmjs.org/process-nextick-args 13ms (from cache)                                              
npm http fetch GET 200 https://registry.npmjs.org/safe-buffer 19ms (from cache)                                                       
npm http fetch GET 200 https://registry.npmjs.org/string_decoder 19ms (from cache)                                                    
npm http fetch GET 200 https://registry.npmjs.org/util-deprecate 21ms (from cache)                                                    
npm http fetch GET 200 https://registry.npmjs.org/aproba 64ms (from cache)                                                            
npm http fetch GET 200 https://registry.npmjs.org/has-unicode 65ms (from cache)                                                       
npm http fetch GET 200 https://registry.npmjs.org/object-assign 67ms (from cache)                                                     
npm http fetch GET 200 https://registry.npmjs.org/signal-exit 72ms (from cache)                                                       
npm http fetch GET 200 https://registry.npmjs.org/string-width 77ms (from cache)                                                      
npm http fetch GET 200 https://registry.npmjs.org/strip-ansi 84ms (from cache)                                                        
npm http fetch GET 200 https://registry.npmjs.org/wide-align 86ms (from cache)                                                        
npm http fetch GET 200 https://registry.npmjs.org/code-point-at 8ms (from cache)                                                      
npm http fetch GET 200 https://registry.npmjs.org/is-fullwidth-code-point 9ms (from cache)                                            
npm http fetch GET 200 https://registry.npmjs.org/number-is-nan 3ms (from cache)                                                      
npm http fetch GET 200 https://registry.npmjs.org/ansi-regex 2ms (from cache)                                                         
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 349ms                                                            
npm timing stage:loadIdealTree Completed in 386ms                                                                                     
npm timing stage:generateActionsToTake Completed in 18ms                                                                              
npm verb correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing                                                      
npm timing audit compress Completed in 7ms                                                                                            
npm info audit Submitting payload of 2276bytes                                                                                        
npm verb lock using /root/.npm/_locks/staging-f7cd5cbeac309436.lock for /home/vagrant/git/opencv4Node/node_modules/.staging           
npm timing action:extract Completed in 531ms                                                                                          
npm timing action:finalize Completed in 56ms                                                                                          
npm timing action:refresh-package-json Completed in 87ms                                                                              
npm info lifecycle [email protected]~preinstall: [email protected]                                                                      
npm info lifecycle [email protected]~preinstall: [email protected]                                                                              
npm info lifecycle [email protected]~preinstall: [email protected]                                                                
npm info lifecycle [email protected]~preinstall: [email protected]                                            
npm info lifecycle [email protected]~preinstall: [email protected]                                                                  
npm info lifecycle [email protected]~preinstall: [email protected]                                                                        
npm info lifecycle [email protected]~preinstall: [email protected]                                                                    
npm info lifecycle [email protected]~preinstall: [email protected]                                                                          
npm info lifecycle [email protected]~preinstall: [email protected]                                                                            
npm info lifecycle [email protected]~preinstall: [email protected]                                                                
npm info lifecycle [email protected]~preinstall: [email protected]                                            
npm info lifecycle [email protected]~preinstall: [email protected]                                                                
npm info lifecycle [email protected]~preinstall: [email protected]                                                  
npm info lifecycle [email protected]~preinstall: [email protected]                                                                    
npm info lifecycle [email protected]~preinstall: [email protected]                                                                  
npm info lifecycle [email protected]~preinstall: [email protected]                                                                    
npm info lifecycle [email protected]~preinstall: [email protected]                                                              
npm info lifecycle [email protected]~preinstall: [email protected]                                                                      
npm info lifecycle [email protected]~preinstall: [email protected]                                                                  
npm info lifecycle [email protected]~preinstall: [email protected]                                                              
npm info lifecycle [email protected]~preinstall: [email protected]                                                            
npm info lifecycle [email protected]~preinstall: [email protected]                                                          
npm info lifecycle [email protected]~preinstall: [email protected]                                                                      
npm info lifecycle [email protected]~preinstall: [email protected]                                                                                
npm info lifecycle [email protected]~preinstall: [email protected]                                                                              
npm info lifecycle [email protected]~preinstall: [email protected]                                                                
npm info lifecycle [email protected]~preinstall: [email protected]                                                                
npm timing action:preinstall Completed in 28ms                                                                                        
npm info linkStuff [email protected]                                                                                                   
npm info linkStuff [email protected]                                                                                                       
npm info linkStuff [email protected]                                                                                                
npm info linkStuff [email protected]                                                                                      
npm info linkStuff [email protected]                                                                                                 
npm info linkStuff [email protected]                                                                                                    
npm info linkStuff [email protected]                                                                                                  
npm info linkStuff [email protected]                                                                                                     
npm info linkStuff [email protected]                                                                                                      
npm info linkStuff [email protected]                                                                                                
npm info linkStuff [email protected]                                                                                      
npm info linkStuff [email protected]                                                                                                
npm info linkStuff [email protected]                                                                                         
npm info linkStuff [email protected]                                                                                                  
npm info linkStuff [email protected]                                                                                                 
npm info linkStuff [email protected]                                                                                                  
npm info linkStuff [email protected]                                                                                               
npm info linkStuff [email protected]                                                                                                   
npm info linkStuff [email protected]                                                                                                 
npm info linkStuff [email protected]                                                                                               
npm info linkStuff [email protected]                                                                                              
npm info linkStuff [email protected]                                                                                             
npm info linkStuff [email protected]                                                                                                   
npm info linkStuff [email protected]                                                                                                        
npm info linkStuff [email protected]                                                                                                       
npm info linkStuff [email protected]                                                                                                
npm info linkStuff [email protected]                                                                                                
npm timing action:build Completed in 53ms                                                                                             
npm info lifecycle [email protected]~install: [email protected]                                                                         
npm info lifecycle [email protected]~install: [email protected]                                                                                 
npm info lifecycle [email protected]~install: [email protected]                                                                   
npm info lifecycle [email protected]~install: [email protected]                                               
npm info lifecycle [email protected]~install: [email protected]                                                                     
npm info lifecycle [email protected]~install: [email protected]                                                                           
npm info lifecycle [email protected]~install: [email protected]                                                                       
npm info lifecycle [email protected]~install: [email protected]                                                                             
npm info lifecycle [email protected]~install: [email protected]                                                                               
npm info lifecycle [email protected]~install: [email protected]                                                                   
npm info lifecycle [email protected]~install: [email protected]                                               
npm info lifecycle [email protected]~install: [email protected]                                                                   
npm info lifecycle [email protected]~install: [email protected]                                                     
npm info lifecycle [email protected]~install: [email protected]                                                                       
npm info lifecycle [email protected]~install: [email protected]                                                                     
npm info lifecycle [email protected]~install: [email protected]                                                                       
npm info lifecycle [email protected]~install: [email protected]                                                                 
npm info lifecycle [email protected]~install: [email protected]                                                                         
npm info lifecycle [email protected]~install: [email protected]                                                                     
npm info lifecycle [email protected]~install: [email protected]                                                                 
npm info lifecycle [email protected]~install: [email protected]                                                               
npm info lifecycle [email protected]~install: [email protected]                                                             
npm info lifecycle [email protected]~install: [email protected]                                                                         
npm info lifecycle [email protected]~install: [email protected]                                                                                   
npm info lifecycle [email protected]~install: [email protected]                                                                                 
npm info lifecycle [email protected]~install: [email protected]                                                                   
                                                                                                                                      
> [email protected] install /home/vagrant/git/opencv4Node/node_modules/opencv-build                                                 
> node ./install.js                                                                                                                   
                                                                                                                                      
info install if you want to use an own OpenCV installation set OPENCV4NODEJS_DISABLE_AUTOBUILD                                        
info install library dir does not exist: /home/vagrant/git/opencv4Node/node_modules/opencv-build/opencv/build/lib                     
info install running install script...                                                                                                
ERR! Error: Command failed: mkdir -p opencv                                                                                           
mkdir: cannot create directory ‘opencv’: Permission denied                                                                            
                                                                                                                                      
npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle false                                                        
npm verb lifecycle [email protected]~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/vagrant/
ode/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin                                                    
npm verb lifecycle [email protected]~install: CWD: /home/vagrant/git/opencv4Node/node_modules/opencv-build                          
npm info lifecycle [email protected]~install: Failed to exec install script                                                         
npm timing action:install Completed in 344ms                                                                                          
npm verb unlock done using /root/.npm/_locks/staging-f7cd5cbeac309436.lock for /home/vagrant/git/opencv4Node/node_modules/.staging    
npm timing stage:rollbackFailedOptional Completed in 108ms                                                                            
npm timing stage:runTopLevelLifecycles Completed in 2022ms                                                                            
npm WARN [email protected] No description                                                                                             
npm WARN [email protected] No repository field.                                                                                       
                                                                                                                                      
npm verb stack Error: [email protected] install: `node ./install.js`                                                                
npm verb stack Exit status 1                                                                                                          
npm verb stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)                 
npm verb stack     at emitTwo (events.js:126:13)                                                                                      
npm verb stack     at EventEmitter.emit (events.js:214:7)                                                                             
npm verb stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)              
npm verb stack     at emitTwo (events.js:126:13)                                                                                      
npm verb stack     at ChildProcess.emit (events.js:214:7)                                                                             
npm verb stack     at maybeClose (internal/child_process.js:915:16)                                                                   
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)                                           
npm verb pkgid [email protected]                                                                                                    
npm verb cwd /home/vagrant/git/opencv4Node                                                                                            
npm verb Linux 3.16.0-6-amd64                                                                                                         
npm verb argv "/usr/bin/node" "/usr/bin/npm" "install" "--save" "opencv4nodejs" "--verbose"                                           
npm verb node v8.12.0                                                                                                                 
npm verb npm  v6.4.1                                                                                                                  
npm ERR! code ELIFECYCLE                                                                                                              
npm ERR! errno 1                                                                                                                      
npm ERR! [email protected] install: `node ./install.js`                                                                             
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 verb exit [ 1, true ]                                                                                                             
npm timing audit submit Completed in 1407ms                                                                                           
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1412ms                                              
npm timing audit body Completed in 13ms                                                                                               
npm timing npm Completed in 2434ms                                                                                                    
                                                                                                                                      
npm ERR! A complete log of this run can be found in:                                                                                  
npm ERR!     /root/.npm/_logs/2018-09-24T11_39_50_716Z-debug.log                                                                                                                                                                         

demiton avatar Sep 24 '18 11:09 demiton

Running npm install with sudo might be causing a permissions problem. You could try completely removing the node_modules directory and re-running npm install it without sudo. Also make sure you have permission to write to the directory you're installing in?

gpoole avatar Sep 28 '18 05:09 gpoole

Yep, install without sudo.

justadudewhohacks avatar Sep 28 '18 14:09 justadudewhohacks

So TRUE, thank you very much ! I close the issue

demiton avatar Oct 01 '18 11:10 demiton

If you are facing permission error while using npm install, check your node_module directory. It should have both read/write permission. If not, change it to read/write everyone, that's it....!! image Thanks!

maulikpatel890 avatar Oct 05 '20 12:10 maulikpatel890