Closed JonTheoDenseAir closed 1 year ago
The jm script has to be able to find the JSON Machine installation. That’s why the installation instructions are as follows:
The simplest way to install "JSON Machine" is usually to run:
composer require halaxa/json-machine
in the user's home directory or in the same directory in which you intend to install the jm script.
To install composer, you could try brew install composer using homebrew.
See "Additional Documentation" below for further details and alternatives.
If you wish to clone or download the JSON Machine repository instead of installing it using composer,
then please note that jm will assume it resides in the directory ~/github/json-machine/.
Those are the instructions I followed, you're saying the following installation is incorrect?:
$ pwd
/home/jtheo
$ ls jm
jm
$ ls vendor/halaxa/json-machine/*
vendor/halaxa/json-machine/CHANGELOG.md vendor/halaxa/json-machine/Makefile vendor/halaxa/json-machine/composer.json
vendor/halaxa/json-machine/LICENSE.txt vendor/halaxa/json-machine/README.md vendor/halaxa/json-machine/phpunit.xml.dist
vendor/halaxa/json-machine/build:
build-image.sh composer-lt-7.2.json composer-update.sh docker-run.sh update-changelog.php
vendor/halaxa/json-machine/examples:
guzzleHttp.php memLeak.php symfonyHttpClient.php
vendor/halaxa/json-machine/img:
github.png logo.png logo.svg wallpaper.png
vendor/halaxa/json-machine/src:
Exception Items.php JsonDecoder PositionAware.php StringChunks.php TokensWithDebugging.php autoloader.php
FileChunks.php ItemsOptions.php Parser.php StreamChunks.php Tokens.php ValidJsonPointers.php
vendor/halaxa/json-machine/test:
JsonMachineTest bootstrap.php performance
$ ls composer.*
composer.json composer.lock
In your original post, you said you moved the jm script into /usr/bin
Looking more closely at line 290, I see that it assumes support for "named arguments", which is a feature that seems to require PHP 8. Since you indicated you're still on PHP 7, that is probably the issue.
If you don't wish to upgrade to PHP 8, the simplest workaround would presumably be to provide the other arguments explicitly:
json_decode(
string $json,
?bool $associative = null,
int $depth = 512,
int $flags = 0)
OK that makes sense, I will see if I can upgrade.
If not I'll try the workaround above.
btw yes I had copied the jm to /usr/bin not sure why now, but have removed and tried running from my home dir with no surprises same result.
Hi I'll close this ticket as I'm waiting for ops to upgrade. Thanks for your help, much appreciated.
Hello, I've installed as per your instructions (using composer to get json_machine then copying the jm file into /usr/bin + chmod 755) but when I try running a simple command I get an error:
Info:
Any help appreciated, TIA,
Jon