【发布时间】:2019-03-25 14:31:35
【问题描述】:
我有一个使用“watson-developer-cloud”模块的 nodejs 应用程序。使用“npm install --save watson-developer-cloud”包含此模块。
我在运行“npm run tsc”时看到以下问题。
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,35): error TS2304: Cannot find name 'File'.
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,42): error TS2304: Cannot find name 'ReadableStream'.
我在 Mac 上运行它。 节点版本 10.15.3。 我发现很少有文章要求设置节点 bin 目录的路径并重新加载终端。 我这样做了——尽管又遇到了同样的问题。
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,35): error TS2304: Cannot find name 'File'.
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,42): error TS2304: Cannot find name 'ReadableStream'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-program@1.0.0 tsc: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the my-program@1.0.0 tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-03-25T14_29_06_333Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-program@1.0.0 build: `npm run tsc && npm run tslint`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the my-program@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-03-25T14_29_06_351Z-debug.log
ERROR: Service 'my-program' failed to build: The command '/bin/sh -c npm run build' returned a non-zero code: 2```
【问题讨论】: