NodeJS 解析某些软件包的子依赖关系失败

7cwmlq89  于 2022-12-29  发布在  Node.js
关注(0)|答案(1)|浏览(113)

对于一些npm包(我还没有弄清楚为什么),当它试图解决可传递的依赖关系时,构建会失败,例如googleapis。
下面是我的ember-cli-build.js:

app.import('node_modules/googleapis/build/src/index.js', {
  using: [{ transformation: 'cjs', as: 'googleapis' }],
});

以下是错误输出:

Unexpected token

...
'fs' is imported by node_modules/google-auth-library/build/src/auth/googleauth.js, but could not be resolved – treating it as an external dependency
'fs' is imported by commonjs-external:fs, but could not be resolved – treating it as an external dependency
'url' is imported by commonjs-external:url, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/lru-cache/index.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/google-auth-library/build/src/auth/googleauth.js, but could not be resolved – treating it as an external dependency
'util' is imported by commonjs-external:util, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/google-auth-library/build/src/auth/oauth2client.js, but could not be resolved – treating it as an external dependency
'stream' is imported by commonjs-external:stream, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/jws/lib/sign-stream.js, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/jws/lib/verify-stream.js, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/jws/lib/data-stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/jws/lib/sign-stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/jws/lib/verify-stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/jws/lib/data-stream.js, but could not be resolved – treating it as an external dependency
'fs' is imported by node_modules/gtoken/build/src/index.js, but could not be resolved – treating it as an external dependency
...
and some more...
vs91vp4v

vs91vp4v1#

根据自述文件:https://www.npmjs.com/package/googleapis
这是不是意味着使用在浏览器.
你有可以使用googlapis的服务器吗?

相关问题