I have deployed my Node js Application to digitalocean Ubuntu servers. Everything runs fine on localhost. For some reason when I start my node app using "node app.js" on ubuntu digital ocean, I am thrown "Cannot find module '../../Models". The "models" directory includes a few files that i have created including an index.js. My app is correctly configured and installed and I have been working on solving this issue for 2 days. Is ubuntu case sensitive for locating directories? I can't seem to figure out why my modules cannot be located. Thanks.
deploy#yw://home/deploy/ywapp$ node app
module.js:340
throw err;
^
Error: Cannot find module '../../Models'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/deploy/ywapp-1455754628602/routes/access_token/token.js:4:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/deploy/ywapp-1455754628602/routes/access_token/index.js:2:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/deploy/ywapp-1455754628602/routes/auth/user.js:13:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Related
I am using Heroku as a server but after deploying app does not run
Error: Cannot find module './lib/express' at
Function.Module._resolveFilename
(internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/app/node_modules/express/index.js:11:18)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
After upgrading to Mojave, running webpack --mode development on my project now gives me the following error:
ERROR in ./src/templates/contact-list-item.hbs
Module build failed (from ./node_modules/handlebars-loader/index.js):
/Users/username/Desktop/Project/Public/js/node_modules/loader-utils/lib/urlToRequest.js:7
const moduleRequestRegex = /^[^?]*../../;
^
This error is repeated for each of my .hbs files.
I'm uncertain whether this is an npm problem or a webpack problem. I wonder what installing MacOS Mojave might have changed to break this. If anyone has any ideas I would be very grateful! :)
Full stack trace
SyntaxError: Unexpected token .
at new Script (vm.js:74:7)
at NativeCompileCache._moduleCompile (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:226:18)
at Module._compile (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:172:36)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/Users/sammettam/Desktop/Vapor3Test/Public/js/node_modules/loader-utils/lib/index.js:8:22)
at Module._compile (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/Users/sammettam/Desktop/Vapor3Test/Public/js/node_modules/handlebars-loader/index.js:1:81)
at Module._compile (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (/usr/local/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at loadLoader (/usr/local/lib/node_modules/webpack/node_modules/loader-runner/lib/loadLoader.js:13:17)
at iteratePitchingLoaders (/usr/local/lib/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
at runLoaders (/usr/local/lib/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
at NormalModule.doBuild (/usr/local/lib/node_modules/webpack/lib/NormalModule.js:265:3)
at NormalModule.build (/usr/local/lib/node_modules/webpack/lib/NormalModule.js:412:15)
# ./src/features/contacts/contact-form.js 7:0-65 62:17-37
# ./src/components/create-menu.js
# ./src/app.js
After updating VS 2015 to Update 2 gulp is failing executed by Task Runner Explorer, but it works fine from console.
The error is known, but I don't know how it is related to VS 2015. It does work well in VS 2013. Does VS using a different javascript interpreter than nodeJs or VS 2013 do?
It is a Windows 7, Node.js 5.10.1.
Error:
Failed to run "C:\..\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
C:\..\node_modules\gulp-inject\src\inject\index.js:127
startTag,
^
SyntaxError: Unexpected token ,
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\..\node_modules\gulp-inject\index.js:4:28)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Failed to run "C:\..\package.json"...
Failed to run "C:\..\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
C:\..\node_modules\gulp-inject\src\inject\index.js:127
startTag,
^
SyntaxError: Unexpected token ,
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\..\node_modules\gulp-inject\index.js:4:28)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Update:
I have another machine with Windows 10, Node.js 5.10.1 and with Visual Studio 2015 Update 2 where the same stuff works fine
I had this problem recently too - I found updating VS to use my global node install fixed it for me:
https://github.com/VirtoCommerce/vc-community/issues/247#issuecomment-174454440
I had the same problem, but it turned out to be an issue of having an older version of NodeJS. I found this issue on github that helps:
https://github.com/klei/gulp-inject/issues/172
Once updated my NodeJS version to the latest, Gulp was working fine.
I'm using hapi-ninja, all is ok, and I would just run node server, but if I get these errors, I can not run it going to the route localhost:3000(Custom)
vagrant:/vagrant/hapi-ninja$ node server
module.js:340
throw err;
^
Error: Cannot find module 'boom'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/vagrant/hapi-ninja/node_modules/hapi/lib/index.js:3:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
vagrant:/vagrant/hapi-ninja$
The error says it all: you need the module boom.
To install, type in a terminal
npm install boom
When trying to use gulp, I'm having ' Cannot find module 'node-sass-middleware' ' error.
module.js:340
throw err;
^
Error: Cannot find module 'node-sass-middleware'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/wallet/node_modules/gulp-sass/node_modules/node-sass/sass.js:180:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
node-sass-middleware is empty for some reason.
I've installed gulp like
sudo npm install -g gulp
node-sass-middleware folder has appeared, but its empty inside but a node_modules folder which is also empty.
/home/wallet/node_modules/gulp-sass/node_modules/node-sass/node_modules/node-sass-middleware/.js
Am I installing gulp wrong?