Error enoent no such file or directory stat volumeicon icns

Current behavior After we installed and configured Typescript to Cypress: On open cypress and then starting a test, the browser opens and starts loading the test, but before the test actually start...

Current behavior

After we installed and configured Typescript to Cypress:
On open cypress and then starting a test, the browser opens and starts loading the test, but before the test actually starts, Cypress crashes and shows this error:

The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (/Users/maaike/Projects/cypress/cypress/plugins/index.ts)

Error: ENOENT: no such file or directory, stat '/.VolumeIcon.icns'

Desired behavior

With our current configurations we expect Cypress with Typescript added to work.
We followed the instructions, then cleared cache, reinstalled cypress, but nothing helps.
We searched on the shown error but can’t find anything useful. That’s why we think there might be a bug here. I hope you can investigate it and find the cause

Test code to reproduce

tsconfig.json:

{
  "compilerOptions": {
    "target": "es6",
    "lib": ["es6", "dom"],
    "types": ["cypress", "node"],
    "esModuleInterop": true,
    "allowJs": true
  },
  "include": ["**/*.ts"]
}

cypress/plugins/index.ts:

// promisified fs module
import fs from 'fs-extra'
import path from 'path'
import webpack from '@cypress/webpack-preprocessor'

function getConfigurationByFile(file) {
    const pathToConfigFile = path.resolve('cypress', 'config', `${file}.json`)

    return fs.readJson(pathToConfigFile)
}

// plugins file
module.exports = (on, config) => {
    require('cypress-terminal-report/src/installLogsPrinter')(on)
    require('cypress-log-to-output').install(on, (type, event) => {
        return (event.level === 'error' || event.type === 'error') && islogableError(event)
    })
    const options = {
        // send in the options from your webpack.config.js, so it works the same
        // as your app's code
        webpackOptions: require('../../webpack.config'),
        watchOptions: {},
    }
    on('file:preprocessor', webpack(options))

    const environment = process.env.ENVIRONMENT || config.env.ENVIRONMENT || 'acceptance'
    console.log(`plugins/index.ts: Loading local config from cypress/config/${environment}.json...`)
    return getConfigurationByFile(environment)
}

webpack.config.js

const path = require('path')

module.exports = {
    entry: './src/index.ts',
    module: {
        rules: [
            {
                test: /.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/,
            },
        ],
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.js'],
    },
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
    },
}

Versions

Cypress 5.3.0

Any idea why I would get this when trying to run component tests in Vue.js using Cypress? Is this a bug related to running on MacOS Catalina? (I ask because I think VolumeIcon.icns is a OS X thing??)

The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (/Users/MLaw/vue-app/tests/plugins/index.js)

Error: ENOENT: no such file or directory, stat '/.VolumeIcon.icns'

Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`/Users/MLaw/vue-app/tests/plugins/index.js`)
    at Object.get (/Users/MLaw/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:968:15)
    at EventEmitter.handleError (/Users/MLaw/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/index.js:159:20)
    at EventEmitter.emit (events.js:310:20)
    at ChildProcess.<anonymous> (/Users/MLaw/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
    at ChildProcess.emit (events.js:310:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)

My index.js looks like:

    const preprocessor = require('@cypress/vue/dist/plugins/webpack');
module.exports = (on, config) => {
  preprocessor(on, config);
  // IMPORTANT return the config object
  return config
};

Anatoly's user avatar

Anatoly

19.4k3 gold badges25 silver badges41 bronze badges

asked Nov 23, 2020 at 17:31

MLaw's user avatar

6

sudo touch /.VolumeIcon.icns

I use M1 MacOS, it works for me.

answered Feb 16, 2022 at 6:54

troy's user avatar

troytroy

1,8452 gold badges22 silver badges31 bronze badges

1

#unit-testing #vue.js #cypress

#модульное тестирование #vue.js #кипарис

Вопрос:

Есть идеи, почему я получаю это при попытке запустить тесты компонентов с Vue.js использованием Cypress? Это ошибка, связанная с запуском на macOS Catalina? (Я спрашиваю, потому что я думаю, что VolumeIcon.icns — это OS X ??)

 The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (/Users/MLaw/vue-app/tests/plugins/index.js)

Error: ENOENT: no such file or directory, stat '/.VolumeIcon.icns'

Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`/Users/MLaw/vue-app/tests/plugins/index.js`)
    at Object.get (/Users/MLaw/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:968:15)
    at EventEmitter.handleError (/Users/MLaw/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/index.js:159:20)
    at EventEmitter.emit (events.js:310:20)
    at ChildProcess.<anonymous> (/Users/MLaw/Library/Caches/Cypress/5.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
    at ChildProcess.emit (events.js:310:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
 

Мой index.js выглядит так:

     const preprocessor = require('@cypress/vue/dist/plugins/webpack');
module.exports = (on, config) => {
  preprocessor(on, config);
  // IMPORTANT return the config object
  return config
};
 

Комментарии:

1. О, и, кстати, этот файл существует в /.VolumeIcon.icns …. это ссылка на его реальное местоположение.

2. Где вы это взяли — на win / Linux / xos? Где находится этот файл — в каталоге проекта?

3. @vovchisko. Это на OSX

4. Я получал ту же ошибку в моем окне cypress. Однако, когда я заглянул в свой терминал, я обнаружил другую ошибку, связанную с моей конфигурацией cypress babel. Возможно, у вас такая же проблема, и эта ошибка не является реальной причиной проблемы.

5. Так же, как @MMansour получил ошибку, но из терминала было ясно, что у меня отсутствуют зависимости, поэтому просто переустановите зависимости (в моем случае yarn), и это сработало!

Ответ №1:

 sudo touch /.VolumeIcon.icns
 

Я использую M1 macOS, он работает для меня.

Комментарии:

1. Спасибо, это сработало! для чего это происходит?

Проблема: в текущем проекте при запущенных вотчерах в 50% случаев изменение файлы выкидывает ошибку:

ENOENT: no such file or directory, stat ‘/home/username/PhpstormProjects/js/bd/src/ts/classes/bd/file_name.ts___jb_tmp___’
at Error (native)

Что это за постфикс `___jb_tmp___` я без понятия. Гугл ничего не находит. Поиск по node_modules — тоже.
Как вообще определить — в сторону какого плагина копать?

Зависимости:

"dependencies": {
    "gulp": "^3.9.1",
    "gulp-include-source": "0.0.5",
    "gulp-livereload": "^3.8.1",
    "gulp-minify": "0.0.10",
    "gulp-plumber": "^1.1.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-watch": "^4.3.5",
    "ts-loader": "^0.8.2",
    "typescript-extends": "^1.0.1"
  },
  "devDependencies": {
    "browser-sync": "^2.12.3",
    "typescript": "^1.9.0-dev.20160422",
    "webpack": "^2.1.0-beta.6",
    "webpack-stream": "^3.2.0"
  }

Таск JS в gulp:

gulp.task('js', function() {
   gulp.src('src/ts/bd.ts')
       .pipe(plumber())
       .pipe(sourcemaps.init())
       .pipe(webpack({
           debug: true,
           devtool: 'source-map',
           module: {
               loaders: [
                   {
                       test: /.ts$/,
                       loader: 'ts-loader',
                       exclude: /node_modules/
                   }
               ]
           },
           output: {
               filename: 'bd.js',
               library: "LibraryName",
               libraryTarget: "var"
           },
           plugins: [
               new ProvidePlugin({
                   __extends: 'typescript-extends'
               })
           ],
           resolve: {
               extensions: ['', '.ts', '.webpack.js', '.web.js', '.js'],
               modulesDirectories: ['node_modules', '.']
           }
       }))
       .pipe(minify())
       .pipe(sourcemaps.write())
       .pipe(gulp.dest('dist/js/'))
       .pipe(reload({stream: true}));
});

Вотчеры и сервер в Gulp

var config = {
    server: {
        baseDir: "./dist"
    },
    host: 'localhost',
    port: 9005,
    ui: {
        port: 8080,
        weinre: {
            port: 9090
        }
    },
    logPrefix: "prefix"
};

gulp.task('watch', function(){
    watch('src/ts/**/**', function(event, cb) {
        gulp.start('js');
    });
    watch('src/*.html', function(event, cb) {
        gulp.start('html');
    });
});

gulp.task('webserver', function () {
    browserSync(config);
});

I recently struggled for a while with an npm error thrown when executing npm install of some package. The error message was npm ERR! enoent ENOENT: no such file or directory, rename 'D:\WebApp\node_modules\lz-string' -> 'D:\WebApp\node_modules.lz-string.DELETE'

Finally, I found a solution and a reason for that issue.

The error occurred when I was trying to install @testing-library/react npm package. It looked like that:

npm ERR! enoent ENOENT error in Visual Studio Code

Hotfix

If you ever get this error, the hotfix is to follow these steps:

  • delete node-modules folder
  • run command npm cache clean --force
  • run command npm install
  • install the package again with npm install your-package-name

It should all work fine after that.

If these commands still don’t solve your issue, and you use git as a source control system, you can try the unbeatable git clean -fdx command. After that, run npm install again. Beware – it removes all files not checked in to git. It may also remove your IDE settings etc., so use with care.

But it’s only a hotfix, a solution for now to unblock you.

Coldfix (solution)

The real reason for this issue in my case turned out to be related to jest. However, not to the testing library itself, but to jest extension for Visual Studio Code.

The reason for the issue is the jest tests runner working in the background. You can see that in the VS Code bottom bar:

Visual Studio Code - jest runner

The real solution is to disable jest runner when installing new packages. You can do it with a Jest: Stop Runner command in Ctrl+Shift+P:

npm ERR! enoent ENOENT fix in Visual Studio by stopping jest runner

I don’t know exactly why this is an issue. I guess jest runner is blocking some files in node-modules, so they cannot be renamed/processed. I hope it helps you too 😉

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Понравилась статья? Поделить с друзьями:
  • Error enoent no such file or directory scandir
  • Error enoent no such file or directory open etc ksc web console setup json
  • Error enoent no such file or directory lstat index pug
  • Error english cover
  • Error endl was not declared in this scope