composer: proc_open(NUL): failed to open stream: No such file or directory
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 © 1997-2018 The PHP Group Zend Engine v3.3.1, Copyright © 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:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (4 by maintainers)
Commits related to this issue
- Add Windows proc-open errors to troubleshooting.md As per these issues: https://github.com/composer/composer/issues/7186 https://github.com/composer/composer/issues/8152 — committed to johnstevenson/composer by johnstevenson 5 years ago
- Add Windows proc-open errors to troubleshooting.md As per these issues: https://github.com/composer/composer/issues/7186 https://github.com/composer/composer/issues/8152 — committed to composer/composer by johnstevenson 5 years ago
- Add Windows proc-open errors to troubleshooting.md As per these issues: https://github.com/composer/composer/issues/7186 https://github.com/composer/composer/issues/8152 — committed to amyluo/composer-doc by johnstevenson 5 years ago
- Update (#1) * Debug: display used authentication for http calls * Command::execute() should always return an integer. * Check that if the getUrlMatches method returns an empty value which means... — committed to xy2z/composer by xy2z 5 years ago
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.
@ToniGashi Alterntively you can use a PHP version that supports OneDrive (>= 7.2.23, >=7.3.10)
The problem is you can not create something laravel-related in a folder within OneDrive. Try doing it outside OneDrive(i.e C:/[newFolderHere]).
sadly, doesn’t seem to work at all trying to use composer on a DFS
https://gist.github.com/phit/4702ac3dd3d593162444c29877546a6e
somewhat related to previous SMB issues https://github.com/composer/composer/issues/8231
Thanks - this solved it by moving out of of the onedrive folder.
@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!
@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!!☺️
@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 doesrun.php
have to to with Composer?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
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.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
Same problem as @IsraelObiagba don’t work if project in onedirve
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.
The problem is indeed caused by OneDrive. Thank you!
Did you follow the advice here: https://github.com/composer/composer/issues/7186