This repository has been archived by the owner. It is now read-only.

Constant 'Error: EACCES, mkdir' failures when trying to run yo #5869

Closed
nominalaeon opened this Issue Aug 3, 2014 · 40 comments

Comments

Projects
None yet
@nominalaeon

nominalaeon commented Aug 3, 2014

I apologize if this is a generator-angular issue, but I've gone back and forth with so many fixes it's hard to keep all the wires straight.

yo --version && echo $PATH $NODE_PATH && node -e 'console.log(process.platform, process.versions)' && cat Gruntfile.js
1.2.1
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/USER/.node/bin
   "darwin"
   { http_parser: '1.0',
      node: '0.10.30',
      v8: '3.14.5.9',
      ares: '1.9.0-DEV',
      uv: '0.10.28',
      zlib: '1.2.3',
      modules: '11',
      openssl: '1.0.1h' }
    // Generated on 2014-08-02 using generator-webapp 0.4.9
    'use strict';

    // # Globbing
    // for performance reasons we're only matching one level down:
    // 'test/spec/{,*/}*.js'
    // use this if you want to recursively match all subfolders:
    // 'test/spec/**/*.js'

    module.exports = function (grunt) {

        // Load grunt tasks automatically
        require('load-grunt-tasks')(grunt);

        // Time how long tasks take. Can help when optimizing build times
        require('time-grunt')(grunt);

        // Configurable paths
        var config = {
            app: 'app',
            dist: 'dist'
        };

        // Define the configuration for all the tasks
        grunt.initConfig({

            // Project settings
            config: config,

            // Watches files for changes and runs tasks based on the changed files
            watch: {
                bower: {
                    files: ['bower.json'],
                    tasks: ['bowerInstall']
                },
                js: {
                    files: ['<%= config.app %>/scripts/{,*/}*.js'],
                    tasks: ['jshint'],
                    options: {
                        livereload: true
                    }
                },
                jstest: {
                    files: ['test/spec/{,*/}*.js'],
                    tasks: ['test:watch']
                },
                gruntfile: {
                    files: ['Gruntfile.js']
                },
                styles: {
                    files: ['<%= config.app %>/styles/{,*/}*.css'],
                    tasks: ['newer:copy:styles', 'autoprefixer']
                },
                livereload: {
                    options: {
                        livereload: '<%= connect.options.livereload %>'
                    },
                    files: [
                        '<%= config.app %>/{,*/}*.html',
                        '.tmp/styles/{,*/}*.css',
                        '<%= config.app %>/images/{,*/}*'
                    ]
                }
            },

            // The actual grunt server settings
            connect: {
                options: {
                    port: 9000,
                    open: true,
                    livereload: 35729,
                    // Change this to '0.0.0.0' to access the server from outside
                    hostname: 'localhost'
                },
                livereload: {
                    options: {
                        middleware: function(connect) {
                            return [
                                connect.static('.tmp'),
                                connect().use('/bower_components', connect.static('./bower_components')),
                                connect.static(config.app)
                            ];
                        }
                    }
                },
                test: {
                    options: {
                        open: false,
                        port: 9001,
                        middleware: function(connect) {
                            return [
                                connect.static('.tmp'),
                                connect.static('test'),
                                connect().use('/bower_components', connect.static('./bower_components')),
                                connect.static(config.app)
                            ];
                        }
                    }
                },
                dist: {
                    options: {
                        base: '<%= config.dist %>',
                        livereload: false
                    }
                }
            },

            // Empties folders to start fresh
            clean: {
                dist: {
                    files: [{
                        dot: true,
                        src: [
                            '.tmp',
                            '<%= config.dist %>/*',
                            '!<%= config.dist %>/.git*'
                        ]
                    }]
                },
                server: '.tmp'
            },

            // Make sure code styles are up to par and there are no obvious mistakes
            jshint: {
                options: {
                    jshintrc: '.jshintrc',
                    reporter: require('jshint-stylish')
                },
                all: [
                    'Gruntfile.js',
                    '<%= config.app %>/scripts/{,*/}*.js',
                    '!<%= config.app %>/scripts/vendor/*',
                    'test/spec/{,*/}*.js'
                ]
            },

            // Mocha testing framework configuration options
            mocha: {
                all: {
                    options: {
                        run: true,
                        urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
                    }
                }
            },

            // Add vendor prefixed styles
            autoprefixer: {
                options: {
                    browsers: ['last 1 version']
                },
                dist: {
                    files: [{
                        expand: true,
                        cwd: '.tmp/styles/',
                        src: '{,*/}*.css',
                        dest: '.tmp/styles/'
                    }]
                }
            },

            // Automatically inject Bower components into the HTML file
            bowerInstall: {
                app: {
                    src: ['<%= config.app %>/index.html'],
                    exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']
                }
            },

            // Renames files for browser caching purposes
            rev: {
                dist: {
                    files: {
                        src: [
                            '<%= config.dist %>/scripts/{,*/}*.js',
                            '<%= config.dist %>/styles/{,*/}*.css',
                            '<%= config.dist %>/images/{,*/}*.*',
                            '<%= config.dist %>/styles/fonts/{,*/}*.*',
                            '<%= config.dist %>/*.{ico,png}'
                        ]
                    }
                }
            },

            // Reads HTML for usemin blocks to enable smart builds that automatically
            // concat, minify and revision files. Creates configurations in memory so
            // additional tasks can operate on them
            useminPrepare: {
                options: {
                    dest: '<%= config.dist %>'
                },
                html: '<%= config.app %>/index.html'
            },

            // Performs rewrites based on rev and the useminPrepare configuration
            usemin: {
                options: {
                    assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images']
                },
                html: ['<%= config.dist %>/{,*/}*.html'],
                css: ['<%= config.dist %>/styles/{,*/}*.css']
            },

            // The following *-min tasks produce minified files in the dist folder
            imagemin: {
                dist: {
                    files: [{
                        expand: true,
                        cwd: '<%= config.app %>/images',
                        src: '{,*/}*.{gif,jpeg,jpg,png}',
                        dest: '<%= config.dist %>/images'
                    }]
                }
            },

            svgmin: {
                dist: {
                    files: [{
                        expand: true,
                        cwd: '<%= config.app %>/images',
                        src: '{,*/}*.svg',
                        dest: '<%= config.dist %>/images'
                    }]
                }
            },

            htmlmin: {
                dist: {
                    options: {
                        collapseBooleanAttributes: true,
                        collapseWhitespace: true,
                        removeAttributeQuotes: true,
                        removeCommentsFromCDATA: true,
                        removeEmptyAttributes: true,
                        removeOptionalTags: true,
                        removeRedundantAttributes: true,
                        useShortDoctype: true
                    },
                    files: [{
                        expand: true,
                        cwd: '<%= config.dist %>',
                        src: '{,*/}*.html',
                        dest: '<%= config.dist %>'
                    }]
                }
            },

            // By default, your `index.html`'s <!-- Usemin block --> will take care of
            // minification. These next options are pre-configured if you do not wish
            // to use the Usemin blocks.
            // cssmin: {
            //     dist: {
            //         files: {
            //             '<%= config.dist %>/styles/main.css': [
            //                 '.tmp/styles/{,*/}*.css',
            //                 '<%= config.app %>/styles/{,*/}*.css'
            //             ]
            //         }
            //     }
            // },
            // uglify: {
            //     dist: {
            //         files: {
            //             '<%= config.dist %>/scripts/scripts.js': [
            //                 '<%= config.dist %>/scripts/scripts.js'
            //             ]
            //         }
            //     }
            // },
            // concat: {
            //     dist: {}
            // },

            // Copies remaining files to places other tasks can use
            copy: {
                dist: {
                    files: [{
                        expand: true,
                        dot: true,
                        cwd: '<%= config.app %>',
                        dest: '<%= config.dist %>',
                        src: [
                            '*.{ico,png,txt}',
                            '.htaccess',
                            'images/{,*/}*.webp',
                            '{,*/}*.html',
                            'styles/fonts/{,*/}*.*'
                        ]
                    }, {
                        expand: true,
                        dot: true,
                        cwd: 'bower_components/bootstrap/dist',
                        src: ['fonts/*.*'],
                        dest: '<%= config.dist %>'
                    }]
                },
                styles: {
                    expand: true,
                    dot: true,
                    cwd: '<%= config.app %>/styles',
                    dest: '.tmp/styles/',
                    src: '{,*/}*.css'
                }
            },

            // Run some tasks in parallel to speed up build process
            concurrent: {
                server: [
                    'copy:styles'
                ],
                test: [
                    'copy:styles'
                ],
                dist: [
                    'copy:styles',
                    'imagemin',
                    'svgmin'
                ]
            }
        });


        grunt.registerTask('serve', function (target) {
            if (target === 'dist') {
                return grunt.task.run(['build', 'connect:dist:keepalive']);
            }

            grunt.task.run([
                'clean:server',
                'concurrent:server',
                'autoprefixer',
                'connect:livereload',
                'watch'
            ]);
        });

        grunt.registerTask('server', function (target) {
            grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
            grunt.task.run([target ? ('serve:' + target) : 'serve']);
        });

        grunt.registerTask('test', function (target) {
            if (target !== 'watch') {
                grunt.task.run([
                    'clean:server',
                    'concurrent:test',
                    'autoprefixer'
                ]);
            }

            grunt.task.run([
                'connect:test',
                'mocha'
            ]);
        });

        grunt.registerTask('build', [
            'clean:dist',
            'useminPrepare',
            'concurrent:dist',
            'autoprefixer',
            'concat',
            'cssmin',
            'uglify',
            'copy:dist',
            'rev',
            'usemin',
            'htmlmin'
        ]);

        grunt.registerTask('default', [
            'newer:jshint',
            'test',
            'build'
        ]);
    };

I just wanted to get some exposure to Yeoman this weekend but I've spent my entire time chowning and uninstall/cache-clear/re-installing. Here's one of the more frequent errors I get when I try to run the Angular generator in my project folder. I'm on a Mac OSX Mavericks

    USERsimac2:PROJECT USER$ yo
    [?] 'Allo Noah! What would you like to do? Run the Angular generator (0.9.5)

    Make sure you are in the directory you want to scaffold into.
    This generator can also be run with: yo angular

         _-----_
        |       |    .--------------------------.
        |--(o)--|    |    Welcome to Yeoman,    |
       `---------´   |   ladies and gentlemen!  |
        ( _´U`_ )    '--------------------------'
        /___A___\
         |  ~  |
       __'.___.'__
     ´   `  |° ´ Y `

    Out of the box I include Bootstrap and some AngularJS recommended modules.

    [?] Would you like to use Sass (with Compass)? Yes
    [?] Would you like to include Bootstrap? Yes
    [?] Would you like to use the Sass version of Bootstrap? Yes
    [?] Which modules would you like to include? angular-animate.js, angular-cookies.js, angular-resource.js, angular-route.js, angular-sanitize.js, angular-touch.js
       create app/styles/main.scss
       create app/index.html
       create bower.json
       create .bowerrc
       create package.json
       create Gruntfile.js
       invoke   angular:common:/usr/local/lib/node_modules/generator-angular/app/index.js
       create     .editorconfig
       create     .gitattributes
       create     .jshintrc
       create     .gitignore
       create     test/.jshintrc
       create     app/.buildignore
       create     app/.htaccess
       create     app/404.html
       create     app/favicon.ico
       create     app/robots.txt
       create     app/views/main.html
       create     app/images/yeoman.png
       invoke   angular:main:/usr/local/lib/node_modules/generator-angular/app/index.js
       create     app/scripts/app.js
       invoke   angular:controller:/usr/local/lib/node_modules/generator-angular/app/index.js
       create     app/scripts/controllers/main.js
       create     test/spec/controllers/main.js
       invoke   karma:app


    I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.


       invoke       angular:route
       invoke           angular:controller:/usr/local/lib/node_modules/generator-angular/route/index.js
       create             app/scripts/controllers/about.js
       create             test/spec/controllers/about.js
       invoke           angular:view:/usr/local/lib/node_modules/generator-angular/route/index.js
       create             app/views/about.html
       create     test/karma.conf.js
       create     .travis.yml
    npm WARN package.json PROJECT@0.0.0 No description
    npm WARN package.json PROJECT@0.0.0 No repository field.
    npm WARN package.json PROJECT@0.0.0 No README data
    npm WARN package.json PROJECT@0.0.0 No description
    npm WARN package.json PROJECT@0.0.0 No repository field.
    npm WARN package.json PROJECT@0.0.0 No README data
    npm WARN deprecated grunt-ngmin@0.0.3: use grunt-ng-annotate instead
    bower cached        git://github.com/es-shims/es5-shim.git#3.1.1
    bower validate      3.1.1 against git://github.com/es-shims/es5-shim.git#~3.1.0
    bower cached        git://github.com/angular/bower-angular.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular.git#1.2.16
    bower cached        git://github.com/angular/bower-angular-animate.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-animate.git#1.2.16
    bower cached        git://github.com/angular/bower-angular-resource.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-resource.git#1.2.16
    bower cached        git://github.com/angular/bower-angular-route.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-route.git#1.2.16
    bower cached        git://github.com/bestiejs/json3.git#3.3.2
    bower validate      3.3.2 against git://github.com/bestiejs/json3.git#~3.3.1
    bower cached        git://github.com/twbs/bootstrap-sass.git#3.2.0+1
    bower validate      3.2.0+1 against git://github.com/twbs/bootstrap-sass.git#~3.2.0
    bower cached        git://github.com/angular/bower-angular-mocks.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-mocks.git#1.2.16
    bower cached        git://github.com/angular/bower-angular-touch.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-touch.git#1.2.16
    bower cached        git://github.com/angular/bower-angular-sanitize.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-sanitize.git#1.2.16
    bower cached        git://github.com/angular/bower-angular-cookies.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-cookies.git#1.2.16
    npm ERR! Error: ENOENT, open '/Users/USER/Desktop/projects/PROJECT/node_modules/grunt/lib/grunt.js'
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>

    npm ERR! System Darwin 13.3.0
    npm ERR! command "node" "/usr/local/bin/npm" "install"
    npm ERR! cwd /Users/USER/Desktop/projects/PROJECT
    npm ERR! node -v v0.10.30
    npm ERR! npm -v 1.4.21
    npm ERR! path /Users/USER/Desktop/projects/PROJECT/node_modules/grunt/lib/grunt.js
    npm ERR! code ENOENT
    npm ERR! errno 34
    bower cached        git://github.com/angular/bower-angular-scenario.git#1.2.16
    bower validate      1.2.16 against git://github.com/angular/bower-angular-scenario.git#1.2.16
    npm ERR! Error: EACCES, mkdir '/Users/USER/.npm/adm-zip/0.2.1'
    npm ERR!  { [Error: EACCES, mkdir '/Users/USER/.npm/adm-zip/0.2.1']
    npm ERR!   errno: 3,
    npm ERR!   code: 'EACCES',
    npm ERR!   path: '/Users/USER/.npm/adm-zip/0.2.1',
    npm ERR!   parent: 'phantomjs' }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! System Darwin 13.3.0
    npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev"
    npm ERR! cwd /Users/USER/Desktop/projects/PROJECT
    npm ERR! node -v v0.10.30
    npm ERR! npm -v 1.4.21
    npm ERR! path /Users/USER/.npm/adm-zip/0.2.1
    npm ERR! code EACCES
    npm ERR! errno 3
    npm ERR! stack Error: EACCES, mkdir '/Users/USER/.npm/adm-zip/0.2.1'
    npm ERR! Error: EACCES, mkdir '/Users/USER/.npm/async/0.7.0'
    npm ERR!  { [Error: EACCES, mkdir '/Users/USER/.npm/async/0.7.0']
    npm ERR!   errno: 3,
    npm ERR!   code: 'EACCES',
    npm ERR!   path: '/Users/USER/.npm/async/0.7.0',
    npm ERR!   parent: 'grunt-contrib-imagemin' }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! System Darwin 13.3.0
    npm ERR! command "node" "/usr/local/bin/npm" "install"
    npm ERR! cwd /Users/USER/Desktop/projects/PROJECT
    npm ERR! node -v v0.10.30
    npm ERR! npm -v 1.4.21
    npm ERR! path /Users/USER/.npm/async/0.7.0
    npm ERR! code EACCES
    npm ERR! errno 3
    npm ERR! stack Error: EACCES, mkdir '/Users/USER/.npm/async/0.7.0'
    npm WARN deprecated ngmin@0.4.1: use ng-annotate instead
    bower cached        git://github.com/jquery/jquery.git#2.1.1
    bower validate      2.1.1 against git://github.com/jquery/jquery.git#>= 1.9.0
    npm ERR! Error: ENOENT, lstat '/Users/USER/Desktop/projects/PROJECT/node_modules/grunt-google-cdn/node_modules/bower/lib/commands/version.js'
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>

    npm ERR! System Darwin 13.3.0
    npm ERR! command "node" "/usr/local/bin/npm" "install"
    npm ERR! cwd /Users/USER/Desktop/projects/PROJECT
    npm ERR! node -v v0.10.30
    npm ERR! npm -v 1.4.21
    npm ERR! path /Users/USER/Desktop/projects/PROJECT/node_modules/grunt-google-cdn/node_modules/bower/lib/commands/version.js
    npm ERR! fstream_path /Users/USER/Desktop/projects/PROJECT/node_modules/grunt-google-cdn/node_modules/bower/lib/commands/version.js
    npm ERR! fstream_type File
    npm ERR! fstream_class FileWriter
    npm ERR! code ENOENT
    npm ERR! errno 34
    npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
    npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
    bower install       json3#3.3.2
    bower install       es5-shim#3.1.1
    bower install       bootstrap-sass-official#3.2.0+1
    bower install       angular-route#1.2.16
    bower install       angular-touch#1.2.16
    bower install       angular-sanitize#1.2.16
    bower install       angular-resource#1.2.16
    bower install       angular-cookies#1.2.16
    bower install       jquery#2.1.1
    bower install       angular-scenario#1.2.16
    bower install       angular-animate#1.2.16
    bower install       angular-mocks#1.2.16
    bower install       angular#1.2.16
    npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/Users/USER/Desktop/projects/PROJECT/node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware'
    npm ERR! error rolling back  grunt-contrib-connect@0.7.1 { [Error: ENOTEMPTY, rmdir '/Users/USER/Desktop/projects/PROJECT/node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware']
    npm ERR! error rolling back   errno: 53,
    npm ERR! error rolling back   code: 'ENOTEMPTY',
    npm ERR! error rolling back   path: '/Users/USER/Desktop/projects/PROJECT/node_modules/grunt-contrib-connect/node_modules/connect/lib/middleware' }

    > fsevents@0.2.0 install /Users/USER/Desktop/projects/PROJECT/node_modules/karma/node_modules/chokidar/node_modules/fsevents
    > node-gyp rebuild

    \
    |
    json3#3.3.2 bower_components/json3

    es5-shim#3.1.1 bower_components/es5-shim

    bootstrap-sass-official#3.2.0+1 bower_components/bootstrap-sass-official
    └── jquery#2.1.1

    angular-route#1.2.16 bower_components/angular-route
    └── angular#1.2.16

    angular-touch#1.2.16 bower_components/angular-touch
    └── angular#1.2.16

    angular-sanitize#1.2.16 bower_components/angular-sanitize
    └── angular#1.2.16

    angular-resource#1.2.16 bower_components/angular-resource
    └── angular#1.2.16

    angular-cookies#1.2.16 bower_components/angular-cookies
    └── angular#1.2.16

    jquery#2.1.1 bower_components/jquery

    angular-scenario#1.2.16 bower_components/angular-scenario
    └── angular#1.2.16

    angular-animate#1.2.16 bower_components/angular-animate
    └── angular#1.2.16

    angular-mocks#1.2.16 bower_components/angular-mocks
    └── angular#1.2.16

    angular#1.2.16 bower_components/angular
    gyp WARN EACCES user "USER" does not have permission to access the dev dir "/Users/USER/.node-gyp/0.10.30"
    gyp WARN EACCES attempting to reinstall using temporary dev dir "/var/folders/9_/840hn40x7td_600pq0m1y1w40000gq/T/.node-gyp"
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR!     /Users/USER/Desktop/projects/PROJECT/npm-debug.log
    npm ERR! not ok code 0
    app/index.html modified.
    gyp: binding.gyp not found (cwd: /Users/USER/Desktop/projects/PROJECT/node_modules/karma/node_modules/chokidar/node_modules/fsevents) while trying to load binding.gyp
    gyp ERR! configure error
    gyp ERR! stack Error: `gyp` failed with exit code: 1
    gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
    gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
    gyp ERR! System Darwin 13.3.0
    gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /Users/USER/Desktop/projects/PROJECT/node_modules/karma/node_modules/chokidar/node_modules/fsevents
    gyp ERR! node -v v0.10.30
    gyp ERR! node-gyp -v v0.13.1
    gyp ERR! not ok
    npm ERR! Error: ENOENT, lstat '/Users/USER/Desktop/projects/PROJECT/node_modules/karma/node_modules/useragent/test/fixtures/pgts.yaml'
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>
    npm ERR! System Darwin 13.3.0
    npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev"
    npm ERR! cwd /Users/USER/Desktop/projects/PROJECT
    npm ERR! node -v v0.10.30
    npm ERR! npm -v 1.4.21
    npm ERR! path /Users/USER/Desktop/projects/PROJECT/node_modules/karma/node_modules/useragent/test/fixtures/pgts.yaml
    npm ERR! fstream_path /Users/USER/Desktop/projects/PROJECT/node_modules/karma/node_modules/useragent/test/fixtures/pgts.yaml
    npm ERR! fstream_type File
    npm ERR! fstream_class FileWriter
    npm ERR! code ENOENT
    npm ERR! errno 34
    npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
    npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
    npm WARN optional dep failed, continuing fsevents@0.2.0
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR!     /Users/USER/Desktop/projects/PROJECT/npm-debug.log
    npm ERR! not ok code 0


         _-----_
        |       |    .---------------------------------------.
        |--(o)--|    |        Bye from us! Chat soon.        |
       `---------´   |                                       |
        ( _´U`_ )    |            The Yeoman Team            |
        /___A___\    | https://github.com/yeoman/yeoman#team |
         |  ~  |     '---------------------------------------'
       __'.___.'__
     ´   `  |° ´ Y `

Additional diagnostics, I've tried resetting my user's access and node_path and everything so so many times. Here's the current state of my bash_profile file:

# Environmental Variables
    # Generic
    export PATH="$PATH":~/.node/bin

It used to have a bit in there to set the NODE_PATH but it wasn't helping so I removed it recently.

Thanks for any help, and again I'm sorry if this belongs in the Angular queue

@MrRhino

This comment has been minimized.

Show comment
Hide comment
@MrRhino

MrRhino Aug 3, 2014

Try this:
sudo chown -R $USER:$GROUP ~/.npm

Taken from this thread:
#5649

MrRhino commented Aug 3, 2014

Try this:
sudo chown -R $USER:$GROUP ~/.npm

Taken from this thread:
#5649

@othiym23

This comment has been minimized.

Show comment
Hide comment
@othiym23

othiym23 Sep 16, 2014

Contributor

What @MrRhino said, probably combined with running npm cache clean to get any busted packages out of your cache. In addition, there are some underlying issues that were addressed by #6043, so you may want to see that ticket for instructions on how to test the fix. Thanks for your patience!

Contributor

othiym23 commented Sep 16, 2014

What @MrRhino said, probably combined with running npm cache clean to get any busted packages out of your cache. In addition, there are some underlying issues that were addressed by #6043, so you may want to see that ticket for instructions on how to test the fix. Thanks for your patience!

@othiym23 othiym23 closed this Sep 16, 2014

@korayguclu

This comment has been minimized.

Show comment
Hide comment
@korayguclu

korayguclu Sep 16, 2014

npm cache cleanhelp me but on mac. But i changed permissions on my ubuntu vagrant box in macos.

korayguclu commented Sep 16, 2014

npm cache cleanhelp me but on mac. But i changed permissions on my ubuntu vagrant box in macos.

@izchk

This comment has been minimized.

Show comment
Hide comment
@izchk

izchk Nov 3, 2014

Thanks using both these fixed for me

izchk commented Nov 3, 2014

Thanks using both these fixed for me

@rmcveigh

This comment has been minimized.

Show comment
Hide comment
@rmcveigh

rmcveigh Nov 5, 2014

Worked for me as well. Thanks!!!

rmcveigh commented Nov 5, 2014

Worked for me as well. Thanks!!!

@bhalke

This comment has been minimized.

Show comment
Hide comment
@bhalke

bhalke Nov 6, 2014

@korayguclu Thank you. npm cache clean

bhalke commented Nov 6, 2014

@korayguclu Thank you. npm cache clean

@shershen08

This comment has been minimized.

Show comment
Hide comment
@shershen08

shershen08 Nov 22, 2014

Helped me as well!

shershen08 commented Nov 22, 2014

Helped me as well!

@jrbranaa

This comment has been minimized.

Show comment
Hide comment
@jrbranaa

jrbranaa Dec 2, 2014

Thanks! Worked like a charm!

jrbranaa commented Dec 2, 2014

Thanks! Worked like a charm!

@neagle

This comment has been minimized.

Show comment
Hide comment
@neagle

neagle Jan 3, 2015

Just a note to say that @MrRhino's advice saved me today, too. Thanks!

neagle commented Jan 3, 2015

Just a note to say that @MrRhino's advice saved me today, too. Thanks!

@metaColin

This comment has been minimized.

Show comment
Hide comment
@metaColin

metaColin Jan 8, 2015

Did both a ownership change & the cache clean. Worked for me.

:-D

metaColin commented Jan 8, 2015

Did both a ownership change & the cache clean. Worked for me.

:-D

@davykiala

This comment has been minimized.

Show comment
Hide comment
@davykiala

davykiala Feb 7, 2015

Thanks that's works for me

davykiala commented Feb 7, 2015

Thanks that's works for me

@chalder

This comment has been minimized.

Show comment
Hide comment
@chalder

chalder Feb 19, 2015

Awesome ! @MrRhino your fix worked like a charm!

chalder commented Feb 19, 2015

Awesome ! @MrRhino your fix worked like a charm!

@shyamsandeep

This comment has been minimized.

Show comment
Hide comment
@shyamsandeep

shyamsandeep Mar 13, 2015

sudo chown -R $USER:$GROUP ~/.npm

above command helped me and worked like charm
@MrRhino is the MAN :)

shyamsandeep commented Mar 13, 2015

sudo chown -R $USER:$GROUP ~/.npm

above command helped me and worked like charm
@MrRhino is the MAN :)

@brapastor

This comment has been minimized.

Show comment
Hide comment
@brapastor

brapastor Mar 27, 2015

@MrRhino eres el mejor me has salvado

brapastor commented Mar 27, 2015

@MrRhino eres el mejor me has salvado

@jrbranaa

This comment has been minimized.

Show comment
Hide comment
@jrbranaa

jrbranaa Mar 27, 2015

Seems like a permission issue. Try using sudo. For example : 'sudo npm update'.

On Mar 27, 2015, at 2:47 PM, Brayan Pastor notifications@github.com wrote:

@MrRhino eres el mejor me has salvado


Reply to this email directly or view it on GitHub.

jrbranaa commented Mar 27, 2015

Seems like a permission issue. Try using sudo. For example : 'sudo npm update'.

On Mar 27, 2015, at 2:47 PM, Brayan Pastor notifications@github.com wrote:

@MrRhino eres el mejor me has salvado


Reply to this email directly or view it on GitHub.

@kichooo

This comment has been minimized.

Show comment
Hide comment
@kichooo

kichooo Mar 29, 2015

Got that issue too.

So, every user needs to to run chown with sudo after making fresh installation of npm?

Is it a good practice? Obviously not. Is there a better fix for that?

kichooo commented Mar 29, 2015

Got that issue too.

So, every user needs to to run chown with sudo after making fresh installation of npm?

Is it a good practice? Obviously not. Is there a better fix for that?

@othiym23

This comment has been minimized.

Show comment
Hide comment
@othiym23

othiym23 Mar 30, 2015

Contributor

kichooo: at some point after the release of npm@2.5.0, the way npm deals with permissions inside the cache got straightened out enough that upgrading to npm@latest (which right now is npm@2.7.4) and fixing permissions once should be good enough to keep this problem from recurring in the future.

Contributor

othiym23 commented Mar 30, 2015

kichooo: at some point after the release of npm@2.5.0, the way npm deals with permissions inside the cache got straightened out enough that upgrading to npm@latest (which right now is npm@2.7.4) and fixing permissions once should be good enough to keep this problem from recurring in the future.

@shawndeprey

This comment has been minimized.

Show comment
Hide comment
@shawndeprey

shawndeprey May 6, 2015

@MrRhino Thank's so much. This solution worked for me.

shawndeprey commented May 6, 2015

@MrRhino Thank's so much. This solution worked for me.

@robertcedwards

This comment has been minimized.

Show comment
Hide comment
@robertcedwards

robertcedwards May 8, 2015

@MrRhino 👍 Thanks! Worked great

robertcedwards commented May 8, 2015

@MrRhino 👍 Thanks! Worked great

@TheRoadSouth

This comment has been minimized.

Show comment
Hide comment
@TheRoadSouth

TheRoadSouth commented May 27, 2015

@MrRhino @othiym23 Thanks, that helped

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 12, 2015

@MrRhino "sudo chown -R $USER:$GROUP ~/.npm" worked!

ghost commented Jul 12, 2015

@MrRhino "sudo chown -R $USER:$GROUP ~/.npm" worked!

@herzzanu

This comment has been minimized.

Show comment
Hide comment
@herzzanu

herzzanu Aug 13, 2015

@MrRhino thanks mate, works like a charm!

herzzanu commented Aug 13, 2015

@MrRhino thanks mate, works like a charm!

@ezdata

This comment has been minimized.

Show comment
Hide comment
@ezdata

ezdata Sep 13, 2015

Just to reiterate, in a single message, what was already stated.

I got numerous error messages, like the one below, that referenced permissions errors.

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/bin/node_modules

The following commands took care of the problem:

sudo npm clean cache //Someone recommended this command to make sure things are nice and clean
sudo chown -R $USER:$GROUP ~/.npm
sudo npm install uglify-js

For those who use PhpStorm, you can set up a File Watcher that will automatically minify your JS file whenever the file is changed/saved. More info here: https://www.jetbrains.com/phpstorm/help/minifying-javascript.html

The only thing I needed to configure in File Watcher was the path to uglify.

/usr/local/bin/node_modules/uglify-js/bin

Here's a screenshot from the File Watcher dialog box:
phpstorm filewatcher settings

ezdata commented Sep 13, 2015

Just to reiterate, in a single message, what was already stated.

I got numerous error messages, like the one below, that referenced permissions errors.

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/bin/node_modules

The following commands took care of the problem:

sudo npm clean cache //Someone recommended this command to make sure things are nice and clean
sudo chown -R $USER:$GROUP ~/.npm
sudo npm install uglify-js

For those who use PhpStorm, you can set up a File Watcher that will automatically minify your JS file whenever the file is changed/saved. More info here: https://www.jetbrains.com/phpstorm/help/minifying-javascript.html

The only thing I needed to configure in File Watcher was the path to uglify.

/usr/local/bin/node_modules/uglify-js/bin

Here's a screenshot from the File Watcher dialog box:
phpstorm filewatcher settings

@Dev-Dipesh

This comment has been minimized.

Show comment
Hide comment
@Dev-Dipesh

Dev-Dipesh Sep 23, 2015

Worked like a charm

npm clean cache
sudo chown -R $(whoami) ~/.npm   --or--   sudo chown -R $USER:$GROUP ~/.npm
yo ...

Dev-Dipesh commented Sep 23, 2015

Worked like a charm

npm clean cache
sudo chown -R $(whoami) ~/.npm   --or--   sudo chown -R $USER:$GROUP ~/.npm
yo ...
@AlexanderTserkovniy

This comment has been minimized.

Show comment
Hide comment
@AlexanderTserkovniy

AlexanderTserkovniy Oct 29, 2015

Hey guys, I have the same problem and the "charm" does not work for me, because it writes next:

chown: cannot access ‘/home/codilime/.npm’: No such file or directory

Does somebody know how to fix this?

Here is error trace from gulp:

[12:13:46] Using gulpfile ~/project-name/gulpfile.js
[12:13:46] Starting 'start'...
[12:13:46] Starting 'build'...
[12:13:46] Starting 'clean'...
[12:13:46] 'clean' errored after 22 ms
[12:13:46] Error in plugin 'gulp-clean'
Unable to delete "[path]/project-name/build" file (EACCES: permission denied, rmdir '[path]/project-name/build/app').
[12:13:46] 'start' errored after 25 ms
[12:13:46] Error in plugin 'run-sequence'
Message:
    An error occured in task 'clean'.
[12:13:46] 'build' errored after 25 ms
[12:13:46] Error in plugin 'run-sequence'
Message:
    An error occured in task 'start'.
[12:13:46] 'build' errored after 26 ms
[12:13:46] Error in plugin 'run-sequence'
Message:
    An error occured in task 'clean'.

Process finished with exit code 1

AlexanderTserkovniy commented Oct 29, 2015

Hey guys, I have the same problem and the "charm" does not work for me, because it writes next:

chown: cannot access ‘/home/codilime/.npm’: No such file or directory

Does somebody know how to fix this?

Here is error trace from gulp:

[12:13:46] Using gulpfile ~/project-name/gulpfile.js
[12:13:46] Starting 'start'...
[12:13:46] Starting 'build'...
[12:13:46] Starting 'clean'...
[12:13:46] 'clean' errored after 22 ms
[12:13:46] Error in plugin 'gulp-clean'
Unable to delete "[path]/project-name/build" file (EACCES: permission denied, rmdir '[path]/project-name/build/app').
[12:13:46] 'start' errored after 25 ms
[12:13:46] Error in plugin 'run-sequence'
Message:
    An error occured in task 'clean'.
[12:13:46] 'build' errored after 25 ms
[12:13:46] Error in plugin 'run-sequence'
Message:
    An error occured in task 'start'.
[12:13:46] 'build' errored after 26 ms
[12:13:46] Error in plugin 'run-sequence'
Message:
    An error occured in task 'clean'.

Process finished with exit code 1
@othiym23

This comment has been minimized.

Show comment
Hide comment
@othiym23

othiym23 Oct 30, 2015

Contributor

@AlexanderTserkovniy I think this may be the relevant line in your output:

Unable to delete "[path]/project-name/build" file (EACCES: permission denied, rmdir '[path]/project-name/build/app').

It looks like you don't have read / execute permission on one of the directories in that path, and that's causing subsequent steps to fail (although it's hard to say exactly how based on the output you have there).

I'm pretty sure you're seeing a different issue than what was described on the rest of this thread, so if you aren't able to figure it out, please open a new one.

Contributor

othiym23 commented Oct 30, 2015

@AlexanderTserkovniy I think this may be the relevant line in your output:

Unable to delete "[path]/project-name/build" file (EACCES: permission denied, rmdir '[path]/project-name/build/app').

It looks like you don't have read / execute permission on one of the directories in that path, and that's causing subsequent steps to fail (although it's hard to say exactly how based on the output you have there).

I'm pretty sure you're seeing a different issue than what was described on the rest of this thread, so if you aren't able to figure it out, please open a new one.

@AlexanderTserkovniy

This comment has been minimized.

Show comment
Hide comment
@AlexanderTserkovniy

AlexanderTserkovniy Oct 30, 2015

Yeah, thanks, it was another issue. I have just somehow created folder build with lock on it, might be because of once I have run the start task in gulp with sudo.
I fixed that through deleting of build folder.

AlexanderTserkovniy commented Oct 30, 2015

Yeah, thanks, it was another issue. I have just somehow created folder build with lock on it, might be because of once I have run the start task in gulp with sudo.
I fixed that through deleting of build folder.

@sahilbabbar

This comment has been minimized.

Show comment
Hide comment
@sahilbabbar

sahilbabbar Jan 25, 2016

@othiym23 My machine is not able to find .npm!

usr/local/bin > sudo chown -R $(whoami) ~/.npm
chown: /var/root/.npm: No such file or directory

yeoman/yeoman#1586 (comment)

sahilbabbar commented Jan 25, 2016

@othiym23 My machine is not able to find .npm!

usr/local/bin > sudo chown -R $(whoami) ~/.npm
chown: /var/root/.npm: No such file or directory

yeoman/yeoman#1586 (comment)

@blacksab

This comment has been minimized.

Show comment
Hide comment
@IanZhao

This comment has been minimized.

Show comment
Hide comment
@IanZhao

IanZhao Feb 24, 2016

also chmod 775 /path/to/folder will help in some conditions

IanZhao commented Feb 24, 2016

also chmod 775 /path/to/folder will help in some conditions

@frankerondon

This comment has been minimized.

Show comment
Hide comment
@frankerondon

frankerondon Feb 28, 2016

@MrRhino MIL GRACIAS ME FUNCIONO. IT WORK'S

frankerondon commented Feb 28, 2016

@MrRhino MIL GRACIAS ME FUNCIONO. IT WORK'S

@bneiluj

This comment has been minimized.

Show comment
Hide comment
@bneiluj

bneiluj Apr 9, 2016

Just run sudo bower install --allow-root.

bneiluj commented Apr 9, 2016

Just run sudo bower install --allow-root.

@woodyhymns

This comment has been minimized.

Show comment
Hide comment
@woodyhymns

woodyhymns May 4, 2016

thanks @MrRhino , ur solution works well for me, thank you:)

woodyhymns commented May 4, 2016

thanks @MrRhino , ur solution works well for me, thank you:)

@LoganDavidTalbot

This comment has been minimized.

Show comment
Hide comment
@LoganDavidTalbot

LoganDavidTalbot Jul 26, 2016

Putting Sudo in front worked for me. Cheers guys.

LoganDavidTalbot commented Jul 26, 2016

Putting Sudo in front worked for me. Cheers guys.

@kichooo

This comment has been minimized.

Show comment
Hide comment
@kichooo

kichooo Jul 26, 2016

Using sudo to create packages in your home directory is not a desired solution ;)

kichooo commented Jul 26, 2016

Using sudo to create packages in your home directory is not a desired solution ;)

@NYCJacob

This comment has been minimized.

Show comment
Hide comment
@NYCJacob

NYCJacob Nov 8, 2017

I am unable to resolve this issue trying to set up the build for bootstrap4 beta2. I created a custom global npm install per link noted by @blacksab I have chown my node_modules but I still get EACCES permission denied errors for node-sass directory on mkdir command. Here is the log file [https://gist.github.com/NYCJacob/1ced8c6222d1698549097dc27ee6d846]

NYCJacob commented Nov 8, 2017

I am unable to resolve this issue trying to set up the build for bootstrap4 beta2. I created a custom global npm install per link noted by @blacksab I have chown my node_modules but I still get EACCES permission denied errors for node-sass directory on mkdir command. Here is the log file [https://gist.github.com/NYCJacob/1ced8c6222d1698549097dc27ee6d846]

@sahilbabbar

This comment has been minimized.

Show comment
Hide comment
@sahilbabbar

sahilbabbar Nov 8, 2017

sahilbabbar commented Nov 8, 2017

@NYCJacob

This comment has been minimized.

Show comment
Hide comment
@NYCJacob

NYCJacob Nov 8, 2017

@sahilbabbar thanks but I did try sudo, it seems since the bootstrap download sets everything to root:root my chown did not work. I finally cloned the repo then everything had the correct permission and npm worked.

NYCJacob commented Nov 8, 2017

@sahilbabbar thanks but I did try sudo, it seems since the bootstrap download sets everything to root:root my chown did not work. I finally cloned the repo then everything had the correct permission and npm worked.

@borgella

This comment has been minimized.

Show comment
Hide comment
@borgella

borgella Feb 13, 2018

@MrRhino thank you man, I just added ./npm* and it fixed it all

borgella commented Feb 13, 2018

@MrRhino thank you man, I just added ./npm* and it fixed it all

@GopalSharma

This comment has been minimized.

Show comment
Hide comment
@GopalSharma

GopalSharma Jun 22, 2018

I have changed the permission to 777
sudo chmod -R 777 dir_name
dir_name is a directory containing all the files, npm and node module.
then I run the following command.
sudo npm rebuild node-sass -f
It solved my issue.

GopalSharma commented Jun 22, 2018

I have changed the permission to 777
sudo chmod -R 777 dir_name
dir_name is a directory containing all the files, npm and node module.
then I run the following command.
sudo npm rebuild node-sass -f
It solved my issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.