Heroku Cannot find module 'lodash/object/assign' - node.js

I'm having issues deploying to Heroku. Got it running locally after i had the same error by simply rm -f node_modules and then reinstalling them with npm install. But when i deploy to heroku the error keeps occurring. Even went in with bash to perform the same steps.
I then used npm shrinkwrap and noticed aws-sdk has a dependency on lodash vs 3.5.0 <3.6.0. So i set the lodash version in my package.json accordingly.
It all still runs locally but keeps crashing on heroku.
Node v5.0.0
NPM v3.3.6
"dependencies": {
"aws-sdk": "^2.6.6",
"bluebird": "^3.4.6",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"goosepage": "0.0.1",
"lodash": "^3.5.0"
}
Additional heroku log
Error: Cannot find module 'lodash/object/assign'
Function.Module._resolveFilename (module.js:337:15)
Function.Module._load (module.js:287:25)
Module.require (module.js:366:17)
require (module.js:385:17)
Object.<anonymous> (/app/node_modules/xmlbuilder/lib/index.js:5:12)
Object.<anonymous> (/app/node_modules/xmlbuilder/lib/index.js:14:4)
Module._compile (module.js:425:26)
Object.Module._extensions..js (module.js:432:10)
Module.load (module.js:356:32)
Function.Module._load (module.js:311:12)
Module.require (module.js:366:17)
require (module.js:385:17)
Object.<anonymous> (/app/node_modules/aws-sdk/lib/xml/builder.js:2:15)
Module._compile (module.js:425:26)
Object.Module._extensions..js (module.js:432:10)
Module.load (module.js:356:32)

Turns out Heroku had a Buildpack that was caching node_modules. Turning off caching didnt help so i had to use the heroku plugin to clear the cached which worked.
https://github.com/heroku/heroku-repo
heroku repo:purge_cache -a appname
The following allegedly should also work incase the above doesn't
heroku config:set NODE_MODULES_TRUE=false

Related

When I try to run parcel, which is a node.js module, I get ERR_DLOPEN_FAILED error

EDIT: My problem is solved. Link for solution
First of all, hello everyone,
Although dependencies and dev dependencies are specified in the package.json file (I also downloaded the modules to the node_modules folder with the npm install command), I get the following error when I enter the npx parcel index.html command. What would be the reason?
"devDependencies": {
"#parcel/transformer-sass": "^2.6.0",
"parcel": "^2.6.0"
},
"dependencies": {
"bootstrap-icons": "^1.8.3"
}
Console output:
PS C:\Users\ubeyd\GitHub\countrypedia> npx parcel index.html
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Error: The specified module could not be found.
\\?\C:\Users\ubeyd\GitHub\countrypedia\node_modules\#parcel\source-map\parcel_sourcemap_node\artifacts\index.win32-x64-msvc.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (C:\Users\ubeyd\GitHub\countrypedia\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at Object.<anonymous> (C:\Users\ubeyd\GitHub\countrypedia\node_modules\#parcel\source-map\parcel_sourcemap_node\index.js:15:18)
at Module._compile (C:\Users\ubeyd\GitHub\countrypedia\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'ERR_DLOPEN_FAILED'
}

NodeJS Azure Sequelize SQL Server - Error: Please install tedious package manually

So I've been developing a NodeJs app locally on my Windows machine. I opened a simple SQL Server instance in the Azure cloud.
While testing this way (node on localhost, SQL Server in Azure cloud) all works fine - everything works.
Once the nodejs rest api is deployed to Azure (excuse my french) all hell broke loose:
Error: Please install tedious package manually
at ConnectionManager._loadDialectModule (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:81:15)
at new ConnectionManager (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\connection-manager.js:17:21)
at new MssqlDialect (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\index.js:14:30)
at new Sequelize (D:\home\site\wwwroot\node_modules\sequelize\lib\sequelize.js:324:20)
at Object.<anonymous> (D:\home\site\wwwroot\util\database.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\home\site\wwwroot\server.js:6:19)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\Program Files (x86)\iisnode\interceptor.js:459:1)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
Application has thrown an uncaught exception and is terminated:
Error: Please install tedious package manually
at ConnectionManager._loadDialectModule (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:81:15)
at new ConnectionManager (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\connection-manager.js:17:21)
at new MssqlDialect (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\index.js:14:30)
at new Sequelize (D:\home\site\wwwroot\node_modules\sequelize\lib\sequelize.js:324:20)
at Object.<anonymous> (D:\home\site\wwwroot\util\database.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\home\site\wwwroot\server.js:6:19)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (D:\Program Files (x86)\iisnode\interceptor.js:459:1)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
here's a snapshot of my package.json file :
"devDependencies": {
"dotenv": "^8.2.0",
"nodemon": "^2.0.3"
},
"dependencies": {
"axios": "^0.19.2",
"azure-storage": "^2.10.3",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"formdata-node": "^2.1.1",
"into-stream": "^5.1.1",
"jsonwebtoken": "^8.5.1",
"mssql": "^6.1.0",
"multer": "^1.4.2",
"nodemailer": "^6.4.5",
"sequelize": "^5.21.7",
"tedious": "^8.0.1",
"uuid-token-generator": "^1.0.0"
}
The error being thrown/shown on the error page I get back from Azure:
HTTP Error 500.1002 - Internal Server Error
I'm not sure what I'm doing wrong. I'd love some help.
When deploying web apps, application environment factors are important. Azure as the hosting service of the program, there are definitely some environments that are different from local.
So I suggest to visit the website https://your-app.scm.azurewebsites.net/DebugConsole to enter kudu and enter the site->wwwroot folder To delete the node_modules folder on the server. Compress node_modules in the local project into zip format, and then drag and drop directly into kudu. Then proceed to the next test.
You also can run npm install tedious in command line, but I failed and don't know why. But I still think this is a good way to solve it. For more details, you can visit the url.Azure web app tedious

Error: Cannot find module './build/Release/DTraceProviderBindings'

I have a project that was created on Windows. After moving to macOS and trying to install and run it, I'm getting the following errors:
Error: Cannot find module './build/Release/DTraceProviderBindings'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/beygel/ITECH/Projects/Moovz-Server/stats/node_modules/dynamodb/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/beygel/ITECH/Projects/Moovz-Server/stats/node_modules/dynamodb/node_modules/bunyan/lib/bunyan.js:34:22)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32) code: 'MODULE_NOT_FOUND'
I'm using the following dependencies:
"dependencies": {
"simple-xmpp": "^1.3.0",
"dynamodb": "^1.1.2",
"html2plaintext": "^2.1.2",
"memcache-plus": "0.2.18",
"memjs": "^1.2.0",
"node-schedule": "^1.3.1",
"request": "^2.83.0",
"socket.io-client": "0.9.16"
}
System info:
node: v11.6.0
npm: 6.8.0
mbp2018: macOS Mojave version 10.14.3
I got rid of this error by running rm -rf node_modules and then running npm i --no-optional with dtrace-provider in my dependencies. It was at version 0.8.7.
This was resolved when I ran npm rebuild dtrace-provider

How to host node.js app on google cloud propertly?

I am trying to host this https://github.com/idiidk/kahoot-tools on google cloud. It works when i test it in cloud shell but when i deploy it it crashes.
I see this error when i go to my app:
Error: Server Error The server encountered an error and could not
complete your request. Please try again in 30 seconds.
In google cloud i see this error:
Error: Cannot find module 'express' at
Function.Module._resolveFilename
(internal/modules/cjs/loader.js:581:15) at Function.Module._load
(internal/modules/cjs/loader.js:507:25) at Module.require
(internal/modules/cjs/loader.js:637:17) at require
(internal/modules/cjs/helpers.js:22:18) at Object.
(/srv/kahoot-tools.js:8:21) at Module._compile
(internal/modules/cjs/loader.js:689:30) at
Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32) at
tryModuleLoad (internal/modules/cjs/loader.js:538:12) at
Function.Module._load (internal/modules/cjs/loader.js:530:3)
express package is missing in "dependencies" of package.json. just add the following:
"express": "^4.16.3"
and also add this node for deploying to App Engine, otherwise dependencies won't get installed:
"scripts": {
"start": "node kahoot-tools.js"
}

can't push ember cli app to heroku due to broccoli-sass and node-sass

I've been trying to deploy to Heroku and it keeps throwing me an error. Apparently node 0.12 was not compatible with node-sass so I updated to node-sass 2.0.1 but it still doesn't work. I'm using ember cli 0.1.15
Module did not self-register.
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/tmp/build_9fa8a1b16bb172aacd5dffe37fe967c1/node_modules/broccoli-sass/node_modules/node-sass/lib/index.js:181:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
! Push rejected, failed to compile Ember CLI app
The issue is happening because Heroku is using the last version of nodejs 0.12.0 which is incompatible with node-sass < 2.0.1 which is being use by broccoli-sass, you updated your local version of node-sass but broccoli-sass is still using the old version of node-sass
There are some pull requests on broccoli-sass to fix that issue
https://github.com/joliss/broccoli-sass/pull/49
https://github.com/joliss/broccoli-sass/pull/43
Meanwhile you can modify your package.json
from
"engines": {
"node": ">= 0.10.0"
}
to
"engines": {
"node": "0.10.x"
}

Resources