我正在使用TypeScript开发该项目:https://github.com/scott-lin/install-npm-version
尝试在另一个项目中使用该软件包时,出现.txt
错误。
复制步骤
Cannot find module 'install-npm-version'
npm install install-npm-version@1.0.2
作为内容创建repro.js文件const inv = require('install-npm-version');
调用复制程序错误
node .\repro.js
答案 0 :(得分:1)
package.json文件中的node: 5868) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: C
llback must be a function
in maybeCallback (fs.js: 129: 9)
in Object.writeFile (fs.js: 1156: 14)
in storeToken (C: \ Users \ ELIOT \ Desktop \ demoDialoglow \ api.js: 100: 6)
in C: \ Users \ ELIOT \ Desktop \ demoDialoglow \ api.js: 79: 7
in getTokenAsync.then.r (C: \ Users \ ELIOT \ Desktop \ demoDialoglow \ node_modules \ go
gle-auth-library \ build \ src \ auth \ oauth2client.js: 97: 51)
in process._tickCallback (internal / process / next_tick.js: 68: 7)
node: 5868) UnhandledPromiseRejectionWarning: Rejection of uncontrolled promise. This e
Ror originated either by throwing inside an asynchronous function without a capture bl
ck, or rejecting a promise that was not handled with .catch (). (Rejection ID
one)
node: 5868) [DEP0018] DeprecationWarning: unmanaged promise rejects are obsolete
In the future, rejections of promise that are not handled will end the N
Process .js with a non-zero exit code.
属性用于在用作代码内Node模块时查找该模块。您的目录以斜杠开头,表示根目录。这是不正确的,这就是代码失败的原因。
要修复:
更改
main
到
"main": "/lib/Install.js",