找不到由NPM在本地安装的模块

时间:2019-08-04 14:19:48

标签: javascript node.js npm node-modules package.json

我正在使用工具,并且已经通过NPM在本地安装了一些模块,当我尝试通过NodeJS要求这些模块时出现错误。我正在Windows 10中工作,我已经尝试设置NODE_PATH等。

下面是我的文件结构:

&str

我通过使用index.js等填充index.html。 以下是我的->project ---->node_modules ---->src -------->css -------->js ----------->index.js ---->package.json ---->index.html 的代码:

package.json

下面是我的require()代码:

{
  "name": "bip39",
  "version": "1.0.0",
  "description": "A tool for converting BIP39 mnemonic phrases to addresses and private keys.",
  "directories": {
    "test": "tests"
  },
  "dependencies": {
    "bip39": "^2.6.0",
    "bigi": "^1.4.2",
    "create-hmac": "^1.1.7",
    "nem-sdk": "^1.6.7"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/PavlosTze/bip39.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/PavlosTze/bip39/issues"
  },
  "homepage": "https://github.com/PavlosTze/bip39#readme"
}

我已经在NPM上执行了以下步骤:
1)npm init
2)npm install bip39
3)npm install nem-sdk
4)npm install bigi
5)npm install create-hmac

所有这些文件都位于var createHmac = require("create-hmac"); var BigInteger = require("bigi"); const bip39 = require("bip39"); const nem = require("nem-sdk").default; 内,但是,每当我在浏览器中运行代码时,都会收到“错误:找不到所有模块的模块” bip39”等。

编辑:在我克隆了相同工具的另一个目录上,在将它与另一个工具合并之前,我没有收到任何错误,并且一切正常,包括require()。等等。您还需要这些文件吗?

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

尝试:

rm -rf node_modules
npm install