错误:尝试运行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 clearnpm 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" } }