cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown error : Element 'script': The attribute 'src' is required but missing

SOLVED

Unknown error : Element 'script': The attribute 'src' is required but missing

I am a newbie Magento2 developer and tried to develop shipping restriction country. So I created custom module which consists install data setup for creating custom product attribute. After that I had done the setup:upgrade and di:compile then static deploy too.

After that the error triggered

Now showing this error only not showing any php error to fix the issue

This is really unknown. I deleted the attribute and module. But still have the same error

    Install data script shows below
    
    namespace Vendor\Restrictproduct\Setup;
    
    use Magento\Eav\Setup\EavSetup;
    use Magento\Eav\Setup\EavSetupFactory;
    use Magento\Framework\Setup\InstallDataInterface;
    use Magento\Framework\Setup\ModuleContextInterface;
    use Magento\Framework\Setup\ModuleDataSetupInterface;
    
    class InstallData implements InstallDataInterface
    {
    private $eavSetupFactory;
    
    public function __construct(EavSetupFactory $eavSetupFactory)
    {
        $this->eavSetupFactory = $eavSetupFactory;
    }
    
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        $eavSetup->addAttribute(
            \Magento\Catalog\Model\Product::ENTITY,
            'shipping_restriction',
            [
                                'group' => 'General'
                'type' => 'varchar',
                'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
                'frontend' => '',
                'label' => 'Disallow shipping to',
                'input' => 'multiselect',
                'class' => '',
                'source' => 'Vendor\Restrictproduct\Model\Attribute\Source\Country',
                'sort_order' => 50,
                'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface:Smiley FrustratedCOPE_GLOBAL,
                'visible' => true,
                'required' => false,
                'user_defined' => false,
                'default' => '',
                'searchable' => false,
                'filterable' => false,
                'comparable' => false,
                'visible_on_front' => true,
                'used_in_product_listing' => true,
                'unique' => false,
                'apply_to' => 'simple,configurable,bundle,grouped'
            ]
        );
    }

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Unknown error : Element 'script': The attribute 'src' is required but missing

Kindly check in your app/code or app/design for script or link tag.

Replace href attribute with src tag.

Example,

Replace

<link href="http://fonts.googleapis.com/css?family=Lato:100,300,400,700" rel="stylesheet" type="text/css"/>


with src

<link src="http://fonts.googleapis.com/css?family=Lato:100,300,400,700" rel="stylesheet" type="text/css"/>
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

1 REPLY 1

Re: Unknown error : Element 'script': The attribute 'src' is required but missing

Kindly check in your app/code or app/design for script or link tag.

Replace href attribute with src tag.

Example,

Replace

<link href="http://fonts.googleapis.com/css?family=Lato:100,300,400,700" rel="stylesheet" type="text/css"/>


with src

<link src="http://fonts.googleapis.com/css?family=Lato:100,300,400,700" rel="stylesheet" type="text/css"/>
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial