无法在运行时找到安装在本地路径上的package.json模块

时间:2017-12-01 21:47:47

标签: node.js npm npm-install package.json

我的package.json中有两个包含本地路径的包:

"graphql-subscriptions": "../graphql-subscriptions",
"subscriptions-transport-ws": "../subscriptions-transport-ws"

npm install后,node_modules正确安装了module.js:529 throw err; ^ Error: Cannot find module 'subscriptions-transport-ws' at Function.Module._resolveFilename (module.js:527:15) at Function.Module._load (module.js:476:23) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object.<anonymous> (/Users/nbhati/projects/graphql-bookstore-server/src/app.factory.js:6:1) at Module._compile (module.js:624:30) at loader (/Users/nbhati/projects/graphql-bookstore-server/node_modules/babel-register/lib/node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (/Users/nbhati/projects/graphql-bookstore-server/node_modules/babel-register/lib/node.js:154:7) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) 。但是,当我运行我的node.js应用程序时,它给出了以下运行时错误:

{{1}}

我错过了什么?

1 个答案:

答案 0 :(得分:1)

神秘解决了。这些包是用TypeScript编写的。我必须编译它们才能导入。