closure-compiler icon indicating copy to clipboard operation
closure-compiler copied to clipboard

goog.isString is not a function

Open brijeshlakkad opened this issue 6 years ago • 6 comments

clouser-library from closer-library npm: v6.9.0 platform: macOS I am using scratch project and after compilation of scratch-blocks, when I run npm start, this error is being thrown.

blockly_compressed_vertical.js:1698 Uncaught TypeError: goog.isString is not a function
    at Object.../scratch-blocks/node_modules/imports-loader/index.js?this=>window!../scratch-blocks/node_modules/exports-loader/index.js?Blockly&goog!./node_modules/scratch-blocks/blockly_compressed_vertical.js.Blockly.Extensions.register (blockly_compressed_vertical.js:1698)
    at blockly_compressed_vertical.js:1709
    at Object.../scratch-blocks/node_modules/imports-loader/index.js?this=>window!../scratch-blocks/node_modules/exports-loader/index.js?Blockly&goog!./node_modules/scratch-blocks/blockly_compressed_vertical.js (blockly_compressed_vertical.js:2442)
    at __webpack_require__ (bootstrap:84)
    at Object../node_modules/scratch-blocks/shim/blockly_compressed_vertical.js (blockly_compressed_vertical.js:1)
    at __webpack_require__ (bootstrap:84)
    at Object../node_modules/scratch-blocks/shim/blockly_compressed_vertical.goog.js (blockly_compressed_vertical.goog.js:1)
    at __webpack_require__ (bootstrap:84)
    at Object.../scratch-blocks/node_modules/imports-loader/index.js?goog=./shim/blockly_compressed_vertical.goog,Blockly=./shim/blockly_compressed_vertical-blocks_compressed!../scratch-blocks/node_modules/exports-loader/index.js?Blockly!./node_modules/scratch-blocks/blocks_compressed_vertical.js (blocks_compressed_vertical.js:2)
    at __webpack_require__ (bootstrap:84)

brijeshlakkad avatar Jan 10 '20 12:01 brijeshlakkad

There is missing of the following function, I guess, In the closure/goog/base.js

/**
 * Returns true if the specified value is a string.
 * @param {?} val Variable to test.
 * @return {boolean} Whether variable is a string.
 */
goog.isString = function(val) {
    return typeof val == 'string';
};

brijeshlakkad avatar Jan 10 '20 16:01 brijeshlakkad

Can you provide more info about what you did get this error? What does npm start do? I don't see the command defined in the scratch-blocks library.

kjin avatar Jan 11 '20 01:01 kjin

I am doing npm start on the scratch-gui. For scratch-blocks, what I am doing is npm run prepublish.

brijeshlakkad avatar Jan 11 '20 04:01 brijeshlakkad

I am doing npm install and npm run prepublish on the Scratch-blocks. When I runnpm start on the Scratch-gui, I am getting this error. Without linking to the local scratch-blocks, It is working fine. However, after nlu run to link up when I try to run npm start on Scratch-gui, I am getting this error. As well, npm start is being successfully compiled. goog.isString is not a function is being thrown in the console of the browser. Thereafter, I found that closure-library downloaded isn't having goog.isString function in the closure/goog/base.js. So, I downloaded the closure-library which has the goog.isString function. Still, It is throwing this TypeError.

brijeshlakkad avatar Jan 11 '20 05:01 brijeshlakkad

goog.isString (and other similar utility methods) have been recently removed from Closure Library (see https://github.com/google/closure-library/commit/9325ce1bbebcfe8c7aa54f8342959c73a1762a77).

It appears that scratch-blocks hasn't been fixed to work with the most recent version of the compiler/library; perhaps it should specify an older version in its dependencies. Either way, I would file an issue with scratch-blocks.

tjgq avatar Jan 11 '20 05:01 tjgq

Thank you @tjgq and @kjin for helping me!!

brijeshlakkad avatar Jan 11 '20 06:01 brijeshlakkad