1
votes

When I checkout my project and execute npm install on Windows 7, my dev_dependencies modules (gulp, electron, ...) they are not being recognized.

I've added "%AppData%\npm\node_modules" to my system path variables, but it has not worked.

When I try: npm run dist, the error I get is:

"gulp' is not recognized as an internal or external command operable program or batch file"

So I assume than node modules are not being recognized. If I try to get gulp manually:

npm install gulp

The problem has been solved to gulp,but not for the rest of modules.

Package.json

{                                                           
"name": "MyApp",                                 
"description": "Desc",                                 
"version": "0.0.2",                                     
"author": {                                             
    "name": "me",                              
    "email": "[email protected]"                    
},                                                      
"main": "build/main.min.js",                            
"scripts": {                                            
    "start": "electron .",                              
    "pack": "gulp compile && build --dir",              
    "dist": "gulp compile && build -w --x64"            
},                                                      
"devDependencies": {                                    
    "del": "^2.2.0",                                    
    "electron-builder": "^5.22.1",                      
    "electron-packager": "^7.3.0",                      
    "electron-prebuilt": "^1.3.1",                      
    "gulp": "^3.9.1",                                   
    "gulp-bower": "0.0.13",                             
    "gulp-clean-css": "^2.0.6",                         
    "gulp-ng-annotate": "^2.0.0",                       
    "gulp-rename": "^1.2.2",                            
    "gulp-sass": "^2.3.1",                              
    "gulp-scss-lint": "^0.3.9",                         
    "gulp-server-livereload": "^1.7.4",                 
    "gulp-shell": "^0.5.2",                             
    "gulp-tsc": "^1.2.0",                               
    "gulp-uglify": "^1.5.3",                            
    "run-sequence": "^1.1.5",                           
    "typings": "^1.0.4"                                 
},                                                      
"dependencies": {                                       
    "fs-extra": "^0.30.0",                              
    "nedb": "^1.8.0"                                    
},                                                      
"build": {                                              
    "appId": "com.electron.app",                      
    "files": [ "build\/**\/*", "node_modules\/**\/*" ]  
},                                                      
"directories": {                                        
    "buildResources": "tmp-build",                      
    "output": "dist",                                   
    "app": "."                                          
}                                                       
}  

Thanks in advance!

== EDIT ==

I also try this solution but it hasn't worked.

1
Just for clarification: You executed npm install and all your dependencies and devDependencies are installed correctly but not recognized?Jonas Bürkel

1 Answers

2
votes

Ok, finally I solve this problem replacing my default path environment variables:

C:\Users(your username)\AppData\Roaming\npm

by

C:\Program Files\nodejs

as @julianpitt suggested in this answer