Error: node_modules/@google-cloud/storage/build/cjs/src/file.d.ts:7:30 - error TS2305: Module '"stream"' has no exported member 'PipelineSource'.

7 import { Writable, Readable, PipelineSource 
} from 'stream';
                               ~~~~~~~~~~~~~~ 

× Failed to compile.

i already installed "@types/node": "^12.20.55", and add , "types": ["node"] to compilerOptions at tsconfig.json file

1

There are 1 best solutions below

0
Raushan Ranjan On

i am also using @google-cloud/storage( latest version ) in Angular 12. But it is throwing error on build time itself.

./node_modules/@google-cloud/storage/build/cjs/src/transfer-manager.js:103:17-34 - Error: Module not found: Error: Can't resolve 'crypto' in 'node_modules/@google-cloud/storage/build/cjs/src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }

./node_modules/@google-cloud/storage/build/cjs/src/util.js:51:26-41 - Error: Module not found: Error: Can't resolve 'path' in '/node_modules/@google-cloud/storage/build/cjs/src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false }

./node_modules/@google-cloud/storage/build/cjs/src/util.js:53:17-34 - Error: Module not found: Error: Can't resolve 'stream' in '/node_modules/@google-cloud/storage/build/cjs/src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }' - install 'stream-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "stream": false }

i had added fallback in webpack as well , but it is not working. same error

resolve: {
    fallback: {
        // "stream": require.resolve("stream-browserify"),
        // "path": require.resolve("path-browserify"),
        // "crypto": require.resolve("crypto-browserify")

        // "stream":'empty',
        // "path": 'empty',
        // "crypto": 'empty'

        "stream": false,
        "path":  false,
        "crypto": false
    }
}