Monday, 12 June 2017

Cannot find module 'lodash' on file system dependency

I'm running Node 6.9.1 on Ubuntu and npm 5.0.3.
I started off by:

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

Then

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

Everything installed with no warnings.

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/apps/myapps/nodejs/MyApp/node_modules/secure_bull

has a symlink to ../secure-bull, which is

/usr/apps/das/das_rtc/nodejs/secure-bull

.

/usr/apps/das/das_rtc/nodejs/secure-bull/node_modules

exists and has modules inside of it including ioredis, but does not have lodash. secure-bull doesn't use lodash directly.

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

has "lodash": "^4.8.2".

/usr/apps/myapps/nodejs/secure-bull/node_modules/ioredis/node_modules

does not exist.

This was working before upgrading to npm 5.0.3



via user994165

No comments:

Post a Comment