我编写了一个节点js程序,其中包含一个名为AWS.config.update()
的方法。当我试图在终端上运行它时,我收到了一个错误:
错误:找不到模块'aws-sdk'
答案 0 :(得分:4)
转到安装节点应用程序的文件夹:
var success = true;
function validator(){
var $this = $(this),
inpVal = $this.val();
if (inpVal!=''){
console.log(inpVal);
} else {
console.log('Empty value');
success = false;
}
return success;
}
$('input[type="text"], textarea').on('blur', this, validator);
$('.contact-form').submit('submit', function(){
var elems = $(this).find('input[type="text"], textarea').blur(validator);
elems.trigger('blur');
if (success==true) {
console.log('Form submitted successfully');
} else {
console.log("Form submission failure");
return false;
}
});
然后运行它来安装aws-sdk:
cd location/to/your/folder
答案 1 :(得分:1)
我正在尝试实现相同的目标并遇到相同的错误
我已经使用aws-sdk
在全局安装了npm i -g aws-sdk
,
请注意,如果没有本地{ {1}}文件夹,其中包含const AWS = require('aws-sdk')
仅适用于MAC的解决方案
node_modules
对于其他操作系统,请找到全局安装的node_modules的位置
答案 2 :(得分:0)
在npm install aws-sdk
之后,请确保您的package.json指定新依赖项的确切版本,例如:
"dependencies": {
"aws-sdk": "2.4.12",
答案 3 :(得分:0)
请参阅https://www.npmjs.com/package/aws-sdk以了解安装import pyopencl as cl
import numpy as np
kernel = """
__kernel void
copy( __global const float *g_data, const int h, const int w, __global float *g_out )
{
// Get global position
size_t row = get_global_id(0);
const int s = row * w;
__global const float *in = &g_data[ s ];
__global float *out = &g_out[ s ];
for(int i=0; i<w; ++i)
{
out[i] = in[i];
}
}
"""
class test:
def __init__(self):
# Create opencl context
platform = cl.get_platforms()[2]
self.__ctx__ = cl.Context( [platform.get_devices()[0]] )
# Create opencl queue
self.__queue__ = cl.CommandQueue(self.__ctx__)
# Build opencl kernel
self.__kernel__ = cl.Program(self.__ctx__, kernel).build()
def __del__(self):
del self.__queue__
del self.__kernel__
del self.__ctx__
def __call__(self, data):
# Get matrix dimensions
h, w = data.shape
mf = cl.mem_flags
# Set input buffer
g_data = cl.Buffer(self.__ctx__, (mf.READ_ONLY | mf.COPY_HOST_PTR), hostbuf=data)
# Set output buffer
self.__out__ = np.zeros( data.shape, dtype=np.float )
g_out = cl.Buffer(self.__ctx__, mf.WRITE_ONLY, self.__out__.nbytes)
# Run kernel
kernel_event = self.__kernel__.copy(
self.__queue__,
(h,),
None,
g_data,
np.int32(h),
np.int32(w),
g_out,
wait_for=None
)
# Copy data
out_event = cl.enqueue_copy(self.__queue__, self.__out__, g_out, wait_for=[kernel_event])
out_event.wait()
# Free memory
g_out.release()
print( self.__out__ )
的各种方法。
我更喜欢在aws-sdk
package.json
并运行"dependencies": {
"aws-sdk": "^2.182.0"
}