-1

我在执行命令时收到以下错误:npm start

Cannot find module 'loadash'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (<Path...>/data/dbConnector.js:3:1)
    at Module._compile (module.js:643:30)
    at loader (<Path...>\node_modules\babel-register\lib\node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (<Path...>\node_modules\babel-register\lib\node.js:154:7)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (<Path...>/data/resolvers.js:2:1)
    at Module._compile (module.js:643:30)
    at loader (<Path...>\node_modules\babel-register\lib\node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (<Path...>\node_modules\babel-register\lib\node.js:154:7)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
[nodemon] app crashed - waiting for file changes before starting...

package.json 文件:

{
  "name": "essentials",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon ./index.js --exec babel-node -e js"
  },
  "author": "test",
  "license": "ISC",
  "dependencies": {
    "casual": "^1.5.19",
    "express": "^4.16.3",
    "express-graphql": "^0.6.12",
    "graphql": "^0.13.2",
    "graphql-tools": "^2.23.1",
    "loadash": "^1.0.0",
    "mongoose": "^5.0.12",
    "nodemon": "^1.17.2",
    "sequelize": "^4.37.5",
    "sqlite3": "^4.0.0"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-stage-0": "^6.24.1"
  }
}

我按照以下链接进行操作,但仍然没有一个对我有用。

https://stackoverflow.com/questions/27431187/cannot-find-module-lodash

https://stackoverflow.com/questions/27431187/cannot-find-module-lodash/36618374

我还看到以下警告消息:

加载参考“ https://schemastore.azurewebsites.net/schemas/json/package.json ”时出现问题:无法从“ https://schemastore.azurewebsites.net/schemas/json/package.json ”加载架构:无法连接到https://schemastore.azurewebsites.net/schemas/json/package.json。错误:证书链中的自签名证书

谁能帮我解决这个问题?

4

1 回答 1

5

包名应该是lodash,不是loadash

在您更正之后,packages.json 您需要执行npm install.

于 2018-03-31T16:48:46.897 回答