Aws-sdk-js: Cannot find module './licensemanager'

Created on 3 Dec 2018  路  14Comments  路  Source: aws/aws-sdk-js

After upgrading from v2.363.0 to v2.368.0 I'm seeing this error on startup:

Error: Cannot find module './licensemanager'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (Redacted/node_modules/aws-sdk/clients/all.js:168:19)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (Redacted/node_modules/aws-sdk/lib/aws.js:6:1)
guidance

All 14 comments

@AndrewBarba

Thanks for opening this issue.

What do you mean by 'startup'? Can you provide an example of the code you are running and include which environment is executing the code?

This file throws the error on v2.368.0:

node ./aws-test.js

// aws-test.js
const AWS = require('aws-sdk')
const Promise = require('bluebird')
const https = require('https')

AWS.config = new AWS.Config({
  accessKeyId: process.env.AWS_ACCESS_KEY_ID,
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  region: 'us-east-1',
  httpOptions: {
    agent: new https.Agent({
      keepAlive: true
    })
  }
})

// Setup promise
AWS.config.setPromisesDependency(Promise)

module.exports = AWS

Error:

internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module './licensemanager'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (Redacted/node_modules/aws-sdk/clients/all.js:168:19)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)

@AndrewBarba @srchase I just spent an hour this morning debugging this too.

To the extent that I can tell, from 2.366.0 and up, all.js refers to the licensemanager module, but it was not delivered in the file tree as part of the NPM package.

See screenshot below. Compare file tree on the left (from 2.368.0) to the module imports on the right.

screen shot 2018-12-03 at 10 09 57 am

To simplify, any require('aws-sdk') is failing for me. Node v8.10. Installing via yarn install

@AndrewBarba Pin a slightly older revision until this is fixed by AWS: npm install --save-exact [email protected]

(unless you wanted the newest stuff 馃槵 )

@mrapczynski I tried that but it seem like Serverless is now installing this version and my deploys are failing even though my code runs fine with older version.

@AndrewBarba and @mrapczynski

Which registry are NPM and Yarn using? Are you both using Serverless?

Hey @AndrewBarba Can you try if you still see the issue when not using Serverless?

I'm using yarn, and if you look at the example above it's not using serverless at all. I'm just running that one file with node and it crashes.

I edited the lock file to just install 2.365.0 and it works fine.

@srchase

When I run npm view [email protected], I get the info printed below which shows the tarball in the registry. And no, I am not using Serverless.

Just for fun, I just downloaded the tarball into a temp folder, and surprise the license manager module is in there. Then I tried an npm rm... and reinstalled 2.368.0 from scratch, and now license manager is also there in the tree. Seems like we need to do some kind of clean up on our node_modules to get the install to be successful.

  dist:
   { integrity: 'sha512-pRq4mn6MGthemTcDETBpQ0accSn/VpZEHzjloFmj2KpEavS8FEwhLvatgFqu8zlDunEfARRyL3Gz3FONO8ZFVA==',
     shasum: '5855201dca9740f253e468f7ce8caa03e5eb696b',
     tarball: 'https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.368.0.tgz',
     fileCount: 1089,
     unpackedSize: 34682284,
     'npm-signature': '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcAIM9CRA9TVsSAnZWagAAeDEP/R3RYgWoVNFUvlsDRlqh\n2zU8Lh/4hXZpq00W7ul16AMEC7HF34hWMnhhk/EhE++FPv6EthmYJzrLkIXD\njR609rgMbEurwHRj2iVIUT12tFTx/PBRi1sN0cYWmE7eGrhwfw/lZvgzZpdm\nnoXZA9nFIqNYZULq9N9orG2BQ3RmYsGQERjSHDr6y28PXZtXoR5W4YrbGesi\nJ2nCqCdUw45bLs4mBYk/41HjhMu9c6yQ0xma8CIfQ5l+zYg36XV0jpUpJFp4\ntMS/xY4knKgAh5/7QyWEJdni27yt8Kpzit9IJ5BGTMN8WBFjNyppHigxQs6Z\ny+8apLkh+J8QtiGNXaRf5gG590DOjGcXMafPLbYJgEPmpRk8DdG6587VwTNe\n6x05yXbvchNbkG/0QhMhzgL74QOZuCzOmjlfMb5aDZrksaJSLU4zgUwYclOH\nbxtV9IWNYvj4etgaFJr72yJV8ezqNlGbc2w54eTCVKuNbkOdWIkBknhHrth2\nUkmMInEMCem2AIU9lagiq7XIPjf69GW3YmraVSk9XKixP4Qp9kmcx968SGJ6\ndIX6CZiqFX8nWtFNje84OlHRNoRonacf6ShcaFH/gqB6PZuzsG4d+7DtctQ8\nyKc2LlOAVyxdiHjyFgTo1x5xEuFjl4iQ5F1E03Kd1QFL79D8yyaBZNrHy3RR\nEw9+\r\n=VDbu\r\n-----END PGP SIGNATURE-----\r\n' } }

@AndrewBarba Have you try remove your node modules and package-lock and install all the packages again? I tried yarn but it still works for me.

Hey guys I'm really sorry, looks like the issue for me was my .yarnclean file which had an entry for LICENSE.*. After removing that its working fine

@AndrewBarba

Glad to hear you got it working!

Going to close out this issue, but happy to re-open if anything further is needed.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings