question

MikeAtkinson-9670 avatar image
0 Votes"
MikeAtkinson-9670 asked MikeAtkinson-9670 commented

Ongoing problems with Laravel quickstart


Hi,

I opened a ticket about this issiue last week but it was redirected to an earlier ticket I opened that is not related (and is now fixed). This is a different fault condition, I'd really appreciate any help you can offer. Thanks

I'm following the tutorial at:
https://docs.microsoft.com/en-us/azure/app-service/tutorial-php-mysql-app?pivots=platform-linux

Everything seems to work until I get to the 'Push to Azure from Git' step. At that point, I get:

remote: > Illuminate\Foundation\ComposerScripts::postInstall
remote: > php artisan optimize
remote: Generating optimized class loader
remote: ..............
remote: The compiled services file has been removed.
remote: Running npm install
remote: npm ERR! install Couldn't read dependencies
remote: npm ERR! Error: No 'name' field
remote: npm ERR! at validName (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:493:40)
remote: An error has occurred during web site deployment.
remote: npm ERR! at final (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:283:27)
remote: npm failed
remote: npm ERR! at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:33
remote: npm ERR! at cb (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\slide\lib\async-map.js:48:11)
remote: npm ERR! at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:237:40
remote: npm ERR! at [object Object].<anonymous> (fs.js:123:5)
remote: npm ERR! at [object Object].emit (events.js:64:17)
remote: npm ERR! at fs.js:1190:12
remote: npm ERR! at Object.oncomplete (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:94:5)
remote: npm ERR! [Error: No 'name' field]
remote: npm ERR! You may report this log at:
remote: npm ERR! <http://github.com/isaacs/npm/issues>;
remote: npm ERR! or email it to:
remote: npm ERR! <npm-@googlegroups.com>
remote:
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
remote: npm ERR! cwd C:\home\site\wwwroot
remote: npm ERR! node -v v0.6.20
remote: npm ERR! npm -v 1.1.37
remote: npm ERR! message No 'name' field
remote: npm
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.

Any help or suggestions as to how to debug would be much appreciated

TIA

azure-webapps-development
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MikeAtkinson-9670,

At first glance, it appears that php artisan optimize has a dependency on npm and there was an issue getting the necessary packages. Is your Windows app service set to PHP? If yes, which version is it set to?

0 Votes 0 ·

Hi Ryan,

Thanks for taking the time to respond.

When I created the webabb I specified runtime as "PHP|7.2" . The full command was:

az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name wh-azure-tomato-test --runtime "PHP|7.2" --deployment-local-git

Hope this helps,

Mike

0 Votes 0 ·

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered MikeAtkinson-9670 commented

Hi @MikeAtkinson-9670,

There are issues with the current tutorial as it hasn't been updated in 4 years. I would try running php composer.phar install from D:\home\site\wwwroot> on Kudu console and check for errors.

I received Try to access array offset on value of type null error exception at which case I ran

 php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
 php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
 php composer-setup.php
 php -r "unlink('composer-setup.php');"

to update composer.phar; see https://github.com/composer/composer/issues/8324 and ran php composer.phar install again.

This is partially due to Composer not readily available on Windows hosted app as opposed to Linux hosted app. Therefore, you may have better luck with a Linux deployment. If do go that route, remove .deployment file from the repo as that's for getting Composer setup on the Windows host machine.

The doc author is aware of this issue and will update the doc.

Regards,
Ryan


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks Ryan, I really appreciate your help. I had no errors via Kudu (as below), I'll give the Linux hosted app a try. Thanks again!

D:\home\site\wwwroot>php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postInstall
php artisan optimize

Generating optimized class loader
The compiled services file has been removed.
1 Vote 1 ·