找不到模块“lodash”
Posted
技术标签:
【中文标题】找不到模块“lodash”【英文标题】:Cannot find module 'loadash' 【发布时间】:2018-09-10 10:01:33 【问题描述】:执行命令时出现以下错误: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://***.com/questions/27431187/cannot-find-module-lodash
https://***.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。错误:证书链中的自签名证书
谁能帮我解决这个问题?
【问题讨论】:
【参考方案1】:包名应该是lodash
,而不是loadash
。
在packages.json
中更正后,您需要执行npm install
。
【讨论】:
非常感谢您的帮助。它现在解决了这个问题:)以上是关于找不到模块“lodash”的主要内容,如果未能解决你的问题,请参考以下文章