Gulp error traversal module - node.js

I am running a Homestead virtual machine and when I run Gulp I got this error message.
I read so many topics on the web and I tried these, but not working.
vagrant#homestead:~/Code/crm.activix.local$ gulp module.js:339
throw err;
^
Error: Cannot find module '../traversal'
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> (/home/vagrant/Code/crm.activix.local/node_modules/laravel-elixir/node_modules/babelify/node_modules/babel-core/lib/transformation/plugin-pass.js:19:18)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)

Homestead and Gulp is a strange thing. I've never gotten it to work properly when running gulp and npm commands inside my Homestead VM.
I use windows, so I have to use gith bash from windows to make gulp/npm stuff work properly. I believe the issue has to do with windows pathing. Take this path from the laravel-elixir install
myproject\node_modules\laravel-elixir\node_modules\gulp-util\node_modules\gulplog\node_modules\glogg\node_modules\sparkles
So dependencies have hteir own dependencies, who have their own dependencies, etc.
When you try to install this, and it has to "mirror" the files on your windows system, it just breaks. At least that's what I think happens.
So to be safe, install node.js on your computer, and run all gulp/npm commands from there. At least that's what I need to do.

Related

Cannot find module '../build/Release/zmq.node' after Pop-OS/Ubuntu update

I recently updated my operating system, which is Pop-OS, which is a Ubuntu's distribution. Before updating, I could run nodejs with ZeroMQ perfectly. Now, I can't run any file with ZeroMQ, not even with just this SLOC-line: const zmq = require('zeromq')
I am using Visual Studio code and also I tried to uninstall and install from scratch nodejs and npm and nothing works.
This is the error:
myuser#pop-os:~/Documents/Lab/fuentes$ node publicadorServer.js
node:internal/modules/cjs/loader:922
throw err;
^
Error: Cannot find module '../build/Release/zmq.node'
Require stack:
- /home/myuser/node_modules/zeromq/lib/index.js
- /home/myuser/node_modules/zeromq/index.js
- /home/myuser/Documents/Lab/fuentes/publicadorServer.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
at Function.Module._load (node:internal/modules/cjs/loader:763:27)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/myuser/node_modules/zeromq/lib/index.js:6:11)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/myuser/node_modules/zeromq/lib/index.js',
'/home/myuser/node_modules/zeromq/index.js',
'/home/myuser/Documents/Lab/fuentes/publicadorServer.js'
]
}
I have installed ZeroMQ with this command at the directory of the project : npm install zeromq#5
Any help would be appreciated.
Finally I could fix it, only with the command npm rebuild.
Unbelievable. I guess, installing a new version of node and the new operating system version make necessary to rebuild it, but I still don't understand that, if I uninstall nodejs and npm, why it was not working. Fortunately, it's all fixed.

Executing node.js programs

I am totally new to node.js and trying to run a program I downloaded from github (as a zip file, instead of git clone). I installed npm, node and python. I added python to the path and added the PYTHON variable. I did an npm install from inside the exploded zip archive. Reading stackoverflow, I I redid as the install as "npm -g install".
I am trying to run charCryptoExample.js from inside the Samples directory. When I execute
node Samples\charCryptoExample.js
I get:
module.js:549
throw err;
^
Error: Cannot find module './dist/node'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\D\Desktop\node-ld-master\node-ld-master\index.js:1:80)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
I am not sure where to begin solving this; I thought the install created the contents of the dist directories. Assuming that the code on github is working, are there build process steps that I am missing?
Yeh, it sounds like you need to build the project.
Have a look in package.json where you should find a "scripts" section. You're looking for a build or compile script (but could be anything).
If you find one, then you can run it with:
$ npm run build or $ npm run compile
Failing that, go back to the README of the project where you'll hopefully find build instructions.

Firebase function Cannot find module 'cycle'

When I try to run any firebase command I get this error.
internal/modules/cjs/loader.js:596
throw err;
^
Error: Cannot find module 'cycle'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/usr/local/lib/node_modules/firebase- tools/node_modules/winston/lib/winston/common.js:11:13)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
I am on
node.js version v10.5.0
npm version 6.1.0
OS Linux Mint 18.3
The files in /usr/local/lib/node_modules/firebase-tools/node_modules are not being updated and installed as expected. Many of the modules are missing.
I had installed firebase locally into what I am going to use as my firebase directory. All of the modules where there. So I copied the files from the local node_modules folder to the global node_modules folder.
To note, this is a bandage to the problem as anytime you go to update firebase you will need to repeat this process.

Meteor error with windows 8.1: your application has errors. waiting for file change

I am trying to create & rum meteor app on win 8.1 pc
what I done, I install meteor using official Meteor installer
I run following commands at desired path
meteor create myapp
this was ok
then cd myapp
this was also ok
but when I run command meteor to run the app, I got following result with error
[[[[[ ~\F\meteor\resolutions ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Errors prevented startup:
While loading plugin `compileTemplatesBatch` from packag
module.js:338:15: Cannot find module
'../modules/es6.object.get-own-property-descriptor'
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> (C:\Users\Dinesh
Singh\AppData\Local\.meteor\packages\templating\1.1.7\pl
Batch.os\npm\node_modules\meteor\ecmascript-runtime\node_mo
pt-runtime\node_modules\meteor-ecmascript-runtime\node_modu
t.js:12:1)
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> (C:\Users\Dinesh
Singh\AppData\Local\.meteor\packages\templating\1.1.7\pl
Batch.os\npm\node_modules\meteor\ecmascript-runtime\node_mo
pt-runtime\node_modules\meteor-ecmascript-runtime\server.js
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 npmRequire (C:\tools\isobuild\bundler.js:1665:14)
at Module.useNode (packages/modules-runtime.js:453:20)
at fileEvaluate (packages/modules-runtime.js:157:20)
at require (packages/modules-runtime.js:92:16)
at meteorInstall.node_modules.meteor.ecmascript-runtime.
(packages/ecmascript-runtime.js:24:18)
at fileEvaluate (packages/modules-runtime.js:158:9)
at require (packages/modules-runtime.js:92:16)
at packages/ecmascript-runtime.js:2832:15
at packages/ecmascript-runtime.js:2845:3
=> Your application has errors. Waiting for file change.
I search over the but didn't find specific result for windows.
As the latest version got this problem, use previous version to create a sample app like this,
meteor create --release 1.2.1 test-app
cd test-app
meteor
found on : https://github.com/meteor/meteor/issues/6609
Based on answers from this issue https://github.com/meteor/meteor/issues/6609 you need to :
Go to "C:\Users\username\AppData\Local.meteor\packages"
Move the packages causing the issue to another folder as you won't be able to delete them on windows due to long file names (templating, templating-tools, ecmascript, standard-minifier-css)
once the file deleted you can run "meteor npm install" then "meteor"
I have tested and it works for me.
I just removed all packages (withaout meteor) from AppData\Local.meteor\packages and run my app again. Meteor downloaded all packeges and now it is working.
The following fix worked for me:
Uninstall meteor from Windows (Programs and Features).
Install meteor (https://www.meteor.com/install)
Create a new Project (https://www.meteor.com/tutorials/blaze/creating-an-app)

Getting meteor 0.9.2 build to work OSX -> Linux

I was using meteor 0.8.x but recently tried to upgrade to 0.9.2. It works locally but I'm not having any luck with meteor bundle or meteor build
First I got this error
/var/projects/myproject/live/bundle/programs/server/boot.js:198
}).run();
^
Error: /var/projects/myproject/live/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
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 bindings (/var/projects/myproject/live/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.<anonymous> (/var/projects/myproject/live/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:1:97)
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)
Things I've tried
Made sure live/bundle/programs/server/node_modules does not exist before starting.
ran npm install in live/bundle/programs/server as the README says to
Things I noticed. There's no bcrypt deps in live/bundle/programs/server/package.json. In 0.8.2 I had commands to install both fibers and bcrypt manually but apparently I don't need the fibers one anymore. It looks like I do need the bcrypt one but it's in a different location than it used to be.
I don't see anything in the docs about needing to go to /var/projects/myproject/live/bundle/programs/server/npm/npm-bcrypt and install bcrypt. I can manually delete it but am I doing something wrong?
Like I said I'm already installing it where 0.8.2 needed it in programs/server. Should I be manually installing in program/server/npm/npm-bcrypt? Should I add that to my list of places to ignore
I put that in just to try it and so now I get this error
/var/projects/myproject/live/bundle/programs/server/node_modules/fibers/future.js:173
throw(ex);
^
Error: Cannot find module 'websocket-driver'
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> (/var/projects/myproject/live/bundle/programs/server/npm/ddp/node_modules/faye-websocket/lib/faye/websocket.js:8:14)
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)
Is that yet another module I need to manually install? I'm getting the impression I'm just doing something fundamentally wrong.
I've got the following meteor packages
.meteor/packages
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
standard-app-packages
audit-argument-checks
iron:router#0.9.3
meteorhacks:npm#1.2.0
npm-container
packages.json
{
"semver": "2.3.1",
"winston": "0.7.3",
"winston-loggly": "1.0.1"
}
note: I'm developing/bundling on OSX but deploying on Ubuntu.
I had similar problems - I posted my solution over on DO
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-meteor-js-application-on-ubuntu-14-04-with-nginx?comment=19780
UPDATE - Here is the answer from that forum:
If anyone else has an issue like this with bcrypt - the app probably has its own copy in
/home/yourapp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/
delete that noise. Then do this.
cd /home/yourapp/bundle/programs/server
npm install bcrypt
Then
cp -r /home/yourapp/bundle/programs/server/node_modules/bcrypt /home/yourapp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/
then start your app and enjoy the meteory goodness.
On the general problem of . . .
(for those stumbling here via Google)
Cannot find module 'MODULE-NAME'
or
Can't find npm module 'MODULE-NAME'
If you've recently added or removed packages while the application is running, try stopping and restarting your meteor application.
// stop ( "CTRL+C" in terminal that launched process )
$ kill `ps ax | grep '[m]eteor' | awk '{print $1}'`
// start
$ meteor

Resources