node keystone Cannot find module './browserify' - node.js

Everything was working until I did a npm install on my project folder.
I am running macOS Sierra 10.12.5, node.js v8.2.1, npm v5.3.0
What I have tried:
uninstalling node/npm and reinstalling
npm install -g browserify
npm insatll browserify on my project folder
reinstall KeystoneJS generator
my package.json
{
"name": "site-name",
"version": "0.0.0",
"private": true,
"dependencies": {
"keystone": "4.0.0-beta.5",
"lodash": "^4.13.1",
"consolidate": "0.14.5",
"nunjucks": "3.0.0",
"node-sass": "4.5.0",
"node-sass-middleware": "0.11.0",
"dotenv": "4.0.0",
"async": "2.1.4",
"express-sslify": "1.2.0"
},
"devDependencies": {
"eslint": "3.15.0",
"eslint-config-keystone": "3.0.0",
"eslint-plugin-react": "^5.1.1"
},
"scripts": {
"lint": "eslint .",
"start": "node keystone.js"
}
}
Here is the output in terminal
node keystone
module.js:487
throw err;
^
Error: Cannot find module './browserify'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/Tyler/Desktop/Forge_Fitness_Site/models/node_modules/sha.js/bin.js:3:18)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/lib/core/importer.js:42:23
at Array.forEach (native)
at importer (/Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/lib/core/importer.js:32:26)
at /Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/lib/core/importer.js:36:22
at Array.forEach (native)
at importer (/Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/lib/core/importer.js:32:26)
at /Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/lib/core/importer.js:36:22
at Array.forEach (native)
at importer (/Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/lib/core/importer.js:32:26)
at Keystone.import (/Users/Tyler/Desktop/Forge_Fitness_Site/node_modules/keystone/index.js:176:42)
at Object.<anonymous> (/Users/Tyler/Desktop/Forge_Fitness_Site/keystone.js:41:16)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)

Well, I fixed the issue, not exactly sure how it happened but somehow I ended up with two node_modules folders in my project directory. Deleting the second one fixed my issue.

Related

/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /node_modules/snappy/build/Release/binding.node)

I am running a loopback4 project inside a docker container which runs on centos 7 version. I have installed gcc inside docker but its still giving below error due to gcc version issue as CXXABI_1.3.9 is missing in gcc#4.8
/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /node_modules/snappy/build/Release/binding.node)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.wrappedLoad [as _load] (/node_modules/newrelic/lib/shimmer.js:373:24)
at Module.require (internal/modules/cjs/loader.js:692:17)
at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
at require (internal/modules/cjs/helpers.js:25:18)
at bindings (/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/node_modules/snappy/snappy.js:2:34)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.wrappedLoad [as _load] (/node_modules/newrelic/lib/shimmer.js:373:24)
I cannot upgrade gcc due to some constraint to include CXXABI_1.3.9 so i started tracking down npm packages which were using CXXABI_1.3.9 and installed it on root level. Current package.json looks like below:
"dependencies": {
"#loopback/boot": "3.1.1",
"#loopback/core": "2.13.0",
"#loopback/repository": "3.2.1",
"#loopback/rest": "8.0.0",
"#loopback/rest-explorer": "3.0.4",
"#loopback/service-proxy": "3.0.4",
"gt-common": "1.0.2",
"kafka-node": "5.0.0",
"loopback-connector-mongodb": "^5.5.0",
"loopback-connector-rest": "^3.7.0",
"newrelic": "^6.14.0",
"tslib": "2.1.0",
"snappy": "6.3.5",
"bindings": "1.5.0",
"nan": "2.14.2",
"prebuild-install": "5.3.0"
}
But it did not work. Can someone please help me to resolve the above issue by changing the npm package's version which is using the CXXABI_1.3.9.
Thanks in advance.

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

When i execute $firebase deploy command i get this error?

I want to create an http function to upload image to firebase storage using firebase cloud functions.
package.json
"dependencies": {
"#google-cloud/storage": "^2.3.0",
"busboy": "^0.2.14",
"cors": "^2.8.5",
"firebase-admin": "^6.1.0",
"firebase-functions": "^2.1.0",
"uuid": "^3.3.2"
}
Error
Error: Error occurred while parsing your function triggers.
TypeError: require(...) is not a function
at Object.<anonymous> (/home/a7me63azza8/Desktop/flutter/flutter_course/functions/index.js:21:45)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /usr/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
at Object.<anonymous> (/usr/lib/node_modules/firebase-
tools/lib/triggerParser.js:53:3)
Error screen shot
I am doing the udemy flutter course as well, and there was a document that asked you to install version 1.7 of #google-cloud/storage.
This worked for me, run:
npm install --save #google-cloud/storage#1.7
then run: firebase deploy

Error: Cannot find module 'mongodb/node_modules/bson'

I am using node 8.1.2 with mongoose 4.11. On starting the app, I am getting these errors:
D:\express_learn\LAM>node app.js
module.js:487
throw err;
^
Error: Cannot find module 'mongodb/node_modules/bson'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\express_learn\LAM\node_modules\mongoose\lib\drivers\node-mongodb-native\objectid.js:8:16)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
D:\express_learn\LAM>
I tried the following solution from here
npm install node-gyp -g
npm cache clean
rm -rf node_modules
npm install
But still getting the same error.
Here is package.json
{
"name": "learn-about-me",
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.6.5",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.3.2",
"ejs": "^1.0.0",
"express": "^4.15.3",
"express-session": "^1.7.6",
"mongoose": "^4.11.0",
"passport": "^0.2.0",
"passport-local": "^1.0.0"
}
}
Here is what I did to resolve the issue
npm cache clean --force
rm -f package-lock.json
node install

Error: Cannot find module 'once'

Error: Cannot find module 'once'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/end-of-stream/index.js:1:74)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
I'm getting this error when I try running my server.js with nodemon. I looked in my node_modules folder and there is a 'once' folder in there. I tried
rm -rf node_modules
npm install
to remove the entire node_modules folder and reinstall but it didn't work. I also did
npm install --save once
and still didn't work.
This is package.json
{
"name": "FullMean_Friends",
"version": "0.0.1",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"body-parser": "latest",
"express": "~4.2.0",
"mongoose": "latest"
}
}

Resources