我正在使用Exercism来学习Javascript,并且每次练习都提供了一个.spec.js文件,他们告诉我用Jasmine运行它。我通过npm全局安装了jasmine-es6,当我运行它时,它错误地说它在我运行命令的目录中找不到package.json:
import javax.persistence.EntityManager;
import javax.persistence.ParameterMode;
import javax.persistence.PersistenceContext;
import javax.persistence.StoredProcedureQuery;
import org.springframework.stereotype.Service;
import your.entity.package.Person;
@Service
public class StoredProcedureManagement {
@PersistenceContext
private EntityManager entityManager;
public void callStoredProcedure(Person person) {
// invoking your sp
StoredProcedureQuery spInsert = entityManager.createStoredProcedureQuery("dbo.usp_employee_insert");
// registring sp parameters
spInsert.registerStoredProcedureParameter("full_name", String.class, ParameterMode.IN);
spInsert.registerStoredProcedureParameter("gender", String.class, ParameterMode.IN);
spInsert.registerStoredProcedureParameter("department", String.class, ParameterMode.IN);
spInsert.registerStoredProcedureParameter("position", String.class, ParameterMode.IN);
spInsert.registerStoredProcedureParameter("salary", Float.class, ParameterMode.IN);
// setting the parameters
spInsert.setParameter("full_name", person.getFullName());
spInsert.setParameter("gender", person.getGender());
spInsert.setParameter("department", person.getDepartment());
spInsert.setParameter("position", person.getPosition());
spInsert.setParameter("salary", person.getSalary());
// executing the sp
spInsert.execute();
}
}
我没有在本地安装npm软件包。我正在运行Ubuntu 16.04。值得注意的是,我已经安装了ES6之前版本的节点和jasmine,卸载了它们,并安装了ES6版本。以下是ken@sub-zero:~/exercism/javascript/rna-transcription$ jasmine rna-transcription.spec.js
/usr/local/lib/node_modules/jasmine-es6/node_modules/esnext-async/lib/main.js:45
throw _context.t0;
^
Error: Cannot find module '/home/ken/exercism/javascript/rna-transcription/package.json'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.runModule [as module] (/usr/local/lib/node_modules/jasmine-es6/node_modules/dist-es6/lib/run.js:13:21)
at _callee$ (/usr/local/lib/node_modules/jasmine-es6/bin/jasmine.js:45:17)
at tryCatch (/usr/local/lib/node_modules/jasmine-es6/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/jasmine-es6/node_modules/regenerator-runtime/runtime.js:299:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/jasmine-es6/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/usr/local/lib/node_modules/jasmine-es6/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
的输出:
npm list
有谁知道为什么我不能让这个工作?谢谢!