2

Hi whenever I try to create a new product I get the following error in the console:

Uncaught TypeError: Cannot read property 'replace' of null

This is the only time I get this, I can create pages, blocks etc. But not the products. It looks like It doesn't generate the static-content correctly for some reason.

I'm running my installation on Forge with nginx, php7.0 and mysql5.7.12-0ubuntu1.1 and Ubuntu 16.04.

The full error log is:

import-handler.js:140 Uncaught TypeError: Cannot read property 'replace' of nullupdateValue @ import-handler.js:140handleNameChanges @ import-handler.js:37setNested @ objects.js:43nested @ objects.js:117set @ element.js:301updateValue @ links.js:57setLink @ links.js:144(anonymous function) @ links.js:165_resolveRequest @ registry.js:413_addRequest @ registry.js:380get @ registry.js:224transfer @ links.js:162setLinks @ links.js:205initLinks @ element.js:182initialize @ element.js:103(anonymous function) @ wrapper.js:109_super @ wrapper.js:106initialize @ abstract.js:69(anonymous function) @ wrapper.js:109UiClass @ class.js:49initComponent @ layout.js:66fire @ jquery.js:3099fireWith @ jquery.js:3211deferred.(anonymous function) @ jquery.js:3301fire @ jquery.js:3099fireWith @ jquery.js:3211deferred.(anonymous function) @ jquery.js:3301(anonymous function) @ layout.js:59execCb @ 4cdbbd4….js:1650context.execCb @ resolver.js:131check @ 4cdbbd4….js:866(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917enable @ 4cdbbd4….js:1143init @ 4cdbbd4….js:774(anonymous function) @ 4cdbbd4….js:991(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:2173execCb @ 4cdbbd4….js:1650context.execCb @ resolver.js:131check @ 4cdbbd4….js:866(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917enable @ 4cdbbd4….js:1143init @ 4cdbbd4….js:774(anonymous function) @ 4cdbbd4….js:991(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:2173execCb @ 4cdbbd4….js:1650context.execCb @ resolver.js:131check @ 4cdbbd4….js:866(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917enable @ 4cdbbd4….js:1143init @ 4cdbbd4….js:774(anonymous function) @ 4cdbbd4….js:991(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:2173execCb @ 4cdbbd4….js:1650context.execCb @ resolver.js:131check @ 4cdbbd4….js:866(anonymous function) @ 4cdbbd4….js:1113(anonymous function) @ 4cdbbd4….js:132(anonymous function) @ 4cdbbd4….js:1156each @ 4cdbbd4….js:57emit @ 4cdbbd4….js:1155check @ 4cdbbd4….js:917enable @ 4cdbbd4….js:1143init @ 4cdbbd4….js:774callGetModule @ 4cdbbd4….js:1170completeLoad @ 4cdbbd4….js:1544onScriptLoad @ 4cdbbd4….js:1671
2

This issue has been logged with the Magento core team:

https://github.com/magento/magento2/issues/5618

Temporary solution:

In the Admin panel navigate to:

Stores->Configuration->Catalog->Catalog->Product Fields Auto-generation.

Set the value of "Mask for SKU" to {{sku}}, save changes and refresh the cache. The Add product page will now load without errors.

0

Surprisingly I ran into this issue again after not seeing in for 8 months. Running Magento 2.1.7 currently.

Lance's answer worked for me but I had to also update Mask for Meta Keywords to "{{name}}" or "{{sku}}" for this to work.

Another solution is changing var str = this.mask, to var str = this.mask || '', in file Magento_Catalog::view/adminhtml/web/js/components/import-handler.js:126. This was previously fixed and I think a recent magento update broke it again for me.

0

I faced the same issue and I found that cost attribute from advanced pricing is required.

Choose Advanced Pricing --> cost and set any value then the save button will be functional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.