Reputation: 3243
I've installed aws-sdk in an ubuntu 20.04 container as follows:
sudo npm install -g aws-sdk
The, when running a script that requires the package, I get:
Error: Cannot find module 'aws-sdk'
Why can't it find my package? What am I doing wrong? Installing with -g
but without sudo
fails with permission errors.
Any help or hints welcome.
Upvotes: 2
Views: 2505
Reputation: 364
You have to link the global module to your project by executing:-
npm link aws-sdk
in your project's root directory provided you have aws-sdk globally installed.
npm link <package-name>
will create a symbolic link from globally-installed package-name to node_modules/
of the current folder.
Source: https://docs.npmjs.com/cli/v7/commands/npm-link
Upvotes: 1