Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc_open(NUL): failed to open stream: No such file or directory #8152

Open
quantumwebco opened this issue May 20, 2019 · 16 comments

Comments

@quantumwebco
Copy link

commented May 20, 2019

Windows 10
Composer 1.8.5
PHP 7.3.1 (cli) (built: Jan 9 2019 22:43:14) ( ZTS MSVC15 (Visual C++ 2017) x86 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies

Trying to run composer update gave me the error proc_open(NUL): failed to open stream: No such file or directory

I've tried all the fixes previously mentioned for this error but nothing works

I've tried from cmd and power shell. At a loss now.

My composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "ext-json": "*",
        "beyondcode/laravel-websockets": "^1.0",
        "calcinai/xero-php": "^1.8",
        "doctrine/dbal": "^2.8",
        "fideloper/proxy": "^4.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "5.8.*",
        "laravel/tinker": "^1.0",
        "mistic100/randomcolor": "^1.0",
        "musonza/chat": "^3.2",
        "pusher/pusher-php-server": "^3.2",
        "yajra/laravel-datatables": "^1.4"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.2",
        "barryvdh/laravel-ide-helper": "^2.4",
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Output of composer diagnose:

[ErrorException]
  proc_open(NUL): failed to open stream: No such file or directory

When I run this command:

composer self -v

I get the following output:

self -v


  [ErrorException]
  proc_open(NUL): failed to open stream: No such file or directory


Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/process/Process.php:285
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 proc_open() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/process/Process.php:285
 Symfony\Component\Process\Process->start() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/process/Process.php:196
 Symfony\Component\Process\Process->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/ProcessExecutor.php:74
 Composer\Util\ProcessExecutor->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/Version/VersionGuesser.php:107
 Composer\Package\Version\VersionGuesser->guessGitVersion() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/Version/VersionGuesser.php:67
 Composer\Package\Version\VersionGuesser->guessVersion() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/Loader/RootPackageLoader.php:88
 Composer\Package\Loader\RootPackageLoader->load() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Factory.php:351
 Composer\Factory->createComposer() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Factory.php:576
 Composer\Factory::create() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:345
 Composer\Console\Application->getComposer() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:458
 Composer\Console\Application->getPluginCommands() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:156
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:61
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24

And I expected this to happen:

@quantumwebco

This comment has been minimized.

Copy link
Author

commented May 20, 2019

One thing I've juss noticed is that composer self -v seems to work outside of the directory with my project in. The project folder is within the OneDrive folder. If I run composer outside the OneDrive folder it seems to work ok.

@alcohol alcohol added the Support label May 21, 2019
@johnstevenson

This comment has been minimized.

Copy link
Member

commented May 21, 2019

I've tried all the fixes previously mentioned for this error but nothing works

Did you follow the advice here: #7186

@quantumwebco

This comment has been minimized.

Copy link
Author

commented May 21, 2019

I've tried all the fixes previously mentioned...

@gregoryxg

This comment has been minimized.

Copy link

commented Jun 4, 2019

I'm having the exact same issue. I moved my project to a development folder at the root of my OneDrive, which is on a separate drive (D:\OneDrive\development).

Everything was working last week, then I updated my OS Build to Windows 10 - 1903 from 1809.

I've followed the instructions at #7186 also.

I've tried uninstalling and re-installing Composer also. The odd thing is if I run composer for a project from within my C:\xampp\htdocs folder, it seems to work fine.

@quantumwebco

This comment has been minimized.

Copy link
Author

commented Jun 4, 2019

It's because of the onedrive virtual filesystem. I previously had issues with vagrant under onedrive. Just have to move you projects out of onedrive folder.

@Cloudmersive

This comment has been minimized.

Copy link

commented Jul 17, 2019

The problem is indeed caused by OneDrive. Thank you!

@IsraelObiagba

This comment has been minimized.

Copy link

commented Aug 6, 2019

After following all the instructions from #7186 I found this thread to be more suited for my problem as it is exactly the same issue I faced.

I wouldn't know the reason though but even after unlinking my OneDrive from my Windows 10 PC, I still couldn't run composer install but after moving the project to C:\Users\myDefaultUserName, it worked fine.

Hope this helps anyone that has recently moved to Windows 10 OS Build 1903.

@Septdir

This comment has been minimized.

Copy link

commented Sep 5, 2019

Same problem as @IsraelObiagba don't work if project in onedirve

@alexdecamillo

This comment has been minimized.

Copy link

commented Sep 6, 2019

Just adding to this issue as it seems to be related to the same root issue (albeit, probably more of a Windows issue). Same as the two above commenters, I wasn't able to run a composer install or composer update without composer telling me Composer could not find a composer.json file, even though the file was right there.

However, it does work when the project isn't in OneDrive.

@VascoGribouille

This comment has been minimized.

Copy link

commented Oct 5, 2019

I have the same issue on my system, it doesn't work due to some onedrive black magic, i've tried to unlink and disconnect onedrive but it doesn't do much, however, i remind of it working, it has broke after an update.

UPDATE: It seems to be fixed with php 7.3.10

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Oct 7, 2019

This does indeed also seem to have something to do with OneDrive. However, it is fixed in PHP 7.2.23 and PHP 7.3

Make sure you use the the latest 7.3 version as the earlier ones also fail on fopen('NUL', 'c'). Note that PHP 7.2.23 is fine.

johnstevenson added a commit to johnstevenson/composer that referenced this issue Oct 8, 2019
As per these issues:

composer#7186
composer#8152
@dc480506

This comment has been minimized.

Copy link

commented Oct 10, 2019

Guys i tried all of the above suggestions and also suggestions mentioned in troubleshooting.md file but i am still getting the same error. I reinstalled xampp with php version 7.3.10, but no luck. Please help
err

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Oct 10, 2019

@dc480506 But this isn't a proc_open(NUL) error.

Rather the failure is caused because /tmp/error-output.txt is not a Windows path. What does run.php have to to with Composer?

@dc480506

This comment has been minimized.

Copy link

commented Oct 11, 2019

@johnstevenson I am new to PHP ....I am trying to build on online compiler for which I need to use proc_open .... I searched for this error endlessly from 2 days ...But no luck ....I found this similar thread so thought may be the solution will be somewhat same ....Can u help me out how to make /tmp/error-output.txt a windows path if that's the problem... Thanks in advance!!☺️

@alexdecamillo

This comment has been minimized.

Copy link

commented Oct 11, 2019

@dc480506 You're not going to find much help on that particular issue here, as your problem isn't related to the issue you're posting on. I want to see if I can help point you in the right direction though.

One of the biggest issues is that /tmp is a Unix directory path. The code that you're using here was almost certainly not written on Windows. It's hard to diagnose the code issues without seeing the code, but a first step you'll want to take is changing any hardcoded Unix directories to Windows directories.

Let's not sidetrack this issue anymore though. If you have more questions, search elsewhere (StackOverflow) as I'm sure there are more people who have wanted to convert Unix directories to Windows. I hope this helped!

@dc480506

This comment has been minimized.

Copy link

commented Oct 11, 2019

@alexdecamillo ...Thanks for looking into this matter ...Will post this as another issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.