节点模块无法导入

时间:2023-01-31 04:53:00

I'm using nodejs third party module in my project. I followed the document given in NPM site. But when i execute js script using node,its showing error node module not found.

我在我的项目中使用nodejs第三方模块。我按照NPM网站上给出的文件。但是当我使用node执行js脚本时,它找不到显示错误的节点模块。

  • My node-module tableau-api My code :
  • 我的node-module tableau-api我的代码:
  • lambda function for alexa skill

    alexa技能的lambda函数

    'use strict';
    const Alexa = require("alexa-sdk");
    var tab = require("tableau-api");
    
    exports.handler = function(event, context, callback) {
        const alexa = Alexa.handler(event, context);
        alexa.registerHandlers(handlers);
        alexa.execute();
    };
    
    const handlers = {
        'LaunchRequest': function() {
            this.emit('SayHello');
        },
        'HelloWorldIntent': function() {
            this.emit('SayHello');
        }
    };
    

Error:

错误:

"errorMessage": "Cannot find module 'tableau-api'",
  "errorType": "Error",
  "stackTrace": [
    "Function.Module._load (module.js:474:25)",
    "Module.require (module.js:596:17)",
    "require (internal/module.js:11:18)",
    "Object.<anonymous> (/var/task/index.js:3:11)",
    "Module._compile (module.js:652:30)",
    "Object.Module._extensions..js (module.js:663:10)",
    "Module.load (module.js:565:32)",
    "tryModuleLoad (module.js:505:12)",
    "Function.Module._load (module.js:497:3)"

1 个解决方案

#1


2  

It could be that you have not installed the package.

可能是您没有安装包。

Try npm install --save tableau-api

尝试npm install --save tableau-api

#1


2  

It could be that you have not installed the package.

可能是您没有安装包。

Try npm install --save tableau-api

尝试npm install --save tableau-api