无法在文件系统依赖项上找到模块“lodash”

时间:2017-06-12 15:07:40

标签: node.js npm

我在Ubuntu和npm 5.0.3上运行Node 6.9.1 我开始了:

npm cache clean --force
rm -rf ~/.node-gyp
rm -rf ~/.npm
node clean -xfd #at the root directory

然后

cd /usr/apps/myapps/nodejs/MyApp
npm install

安装的所有东西都没有警告。

weblogic@weblogic-VirtualBox:/usr/apps/myapps/nodejs/MyApp$ npm start --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'start',
npm verb cli   '--verbose' ]
npm info using npm@5.0.3
npm info using node@v6.9.1
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle MyAppService@0.0.1~prestart: MyAppService@0.0.1
npm info lifecycle MyAppService@0.0.1~start: MyAppService@0.0.1

> MyAppService@0.0.1 start /usr/apps/myapps/nodejs/MyApp
> node index.js --NODE_CONFIG_DIR=../configaitc/MyApp-hits

module.js:471
    throw err;
    ^

Error: Cannot find module 'lodash'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/apps/myapps/nodejs/secure-bull/node_modules/ioredis/lib/redis.js:3:9)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
npm verb lifecycle MyAppService@0.0.1~start: unsafe-perm in lifecycle true
npm verb lifecycle MyAppService@0.0.1~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/apps/myapps/nodejs/MyApp/node_modules/.bin:/opt/java/jdk1.8.0_91/bin:/opt/java/jdk1.8.0_91/bin:/opt/java/jdk1.8.0_91/jre/bin:/usr/apps/python/Python-2.7.5:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/apps/node/latest/bin:/usr/apps/redis/latest/bin:/bin:/bin:/opt/apache-maven-3.3.9/bin:/opt/eclipse/bin:/opt/HP_Fortify/HP_Fortify_SCA_and_Apps_16.20/bin:/usr/apps/das/src/das_rtc/scripts-startapps:/usr/apps/das/src/das_rtc/scripts-fortify
npm verb lifecycle MyAppService@0.0.1~start: CWD: /usr/apps/myapps/nodejs/MyApp
npm info lifecycle MyAppService@0.0.1~start: Failed to exec start script
npm verb stack Error: MyAppService@0.0.1 start: `node index.js --NODE_CONFIG_DIR=../configaitc/MyApp-hits`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at EventEmitter.emit (events.js:191:7)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at ChildProcess.emit (events.js:191:7)
npm verb stack     at maybeClose (internal/child_process.js:877:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm verb pkgid MyAppService@0.0.1
npm verb cwd /usr/apps/myapps/nodejs/MyApp
npm verb Linux 3.13.0-113-generic
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--verbose"
npm verb node v6.9.1
npm verb npm  v5.0.3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! MyAppService@0.0.1 start: `node index.js --NODE_CONFIG_DIR=../configaitc/MyApp-hits`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the MyAppService@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
  

的/ usr /应用/安装MyApps /的NodeJS / MyApp的/ node_modules / secure_bull

有一个符号链接到../secure-bull,即

  

的/ usr /应用/ DAS / das_rtc /的NodeJS /安全-公牛

  

的/ usr /应用/ DAS / das_rtc /的NodeJS /安全-公牛/ node_modules

存在并且其中包含模块,包括ioredis,但没有lodash。 secure-bull不直接使用lodash。

  

/usr/apps/myapps/nodejs/secure-bull/node_modules/ioredis/package.json

有“lodash”:“^ 4.8.2”。

  

的/ usr /应用/安装MyApps /的NodeJS /安全-公牛/ node_modules / ioredis / node_modules

不存在。

这在升级到npm 5.0.3

之前有效

1 个答案:

答案 0 :(得分:0)

安装一些高级软件包时会发生这种情况。 尝试重新安装loadash包。
使用此命令:

sudo npm install loadash --save

Click here to view loadash npm info