错误:尝试运行node.js应用程序时找不到模块“asn1”
我正尝试在节点8.1.4上的Azure应用程序服务上运行Node.js应用程序。
该应用程序在我的本地机器上运行良好。
我将整个应用程序(包括node_modules
复制到Azure应用程序服务,但是我得到了以下结果:
Mon Sep 11 2017 07:52:14 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated: Error: Cannot find module 'asn1' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:289:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (D:\home\site\wwwroot\node_modules\sshpk\lib\formats\pem.js:9:12) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17)
这是来自一个名为sshpk的包。 这里是它的依赖关系:
"dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", "bcrypt-pbkdf": "^1.0.0", "dashdash": "^1.12.0", "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", "tweetnacl": "~0.14.0" },
我查了一下, asn1
包肯定是在顶级node_modules
文件夹中。 我也将asn1
包复制到asn1
里面的sshpk
,但是没有帮助。
什么可能是为什么这个包仍然没有find? 我怎样才能解决这个问题?
更新 :尝试在Azure服务器上运行npm cache clear
和npm install -g npm
,没有任何更改。
整个顶层package.json
:
{ "name": "my_project", "version": "0.0.0", "private": true, "scripts": { "start": "node --inspect server.js" }, "dependencies": { "@google-cloud/datastore": "^1.1.0", "asn1": "^0.2.3", "async": "^2.1.2", "body-parser": "~1.15.2", "cookie-parser": "~1.4.3", "debug": "~2.2.0", "documentdb": "^1.10.0", "dotenv": "^4.0.0", "express": "~4.14.0", "morgan": "~1.7.0", "mssql": "^4.0.4", "serve-favicon": "~2.3.0" } }
- 在Azure上部署反应项目
- 在单个Azure VM上运行两个Nodejs服务器
- Microsoft Bot Framework请求中的MissingProperty错误
- 将JavaScript的Date.now()转换为Stream Analytics中的时间戳
- Azure托pipe的节点应用程序无法find模块“async / each”
- 如何使用nodejs或其他方式列出所有的azure色容器?
- 存储过程受节点mssql对象影响的行
- 如何使用azure-storage-node按修改date查询Azure Blob
- Azure Cosmos DB:TypeError:无法读取未定义的属性'electionId'