I have an application which uses a Meteor with npm module. So I have a packages/mymodule/package.js file which contains:
Npm.depends({my_npm_module:"my_npm_module_version"});
Upon lauching Meteor app, my_npm_module will be installed to packages/mymodule/.npm from npm repository. Now lets say I want to develop my_npm_module on my local machine. How can I force Meteor to use my local directory for my_npm_module, What should I do i my_npm_module source is modified?
If you have a local Npm module it may not be necessary to do this.
Simply use var module = Npm.require('<absolute path to npm module>'); anywhere on your server side.
Related
I've created used Meteor to create an APP that communicates with some hardware through MQTT using Mosquitto. It was done on a Linux computer and everyone went fine. Now I've loaded the files onto OSX and I'm getting the following error with it. I've tried updates sass to the latest verson and then redoing npm install, but to no avail.
=> A patch (Meteor 1.7.0.5) for your current release is available!
Update this project now with 'meteor update --patch'.
Errors prevented startup:
While loading package materialize:materialize#0.100.2:
error: Command failed: /Users/random/.meteor/packages/meteor- tool/.1.7.0_4.x53m8m.ifru9++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm rebuild --update-binary
Cannot download "https://github.com/sass/node- sass/releases/download/v4.5.2/darwin-x64-57_binding.node": HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
I have found a solution.
Remove the node_modules folder
Remove the package-lock.json file
Clear npm cache with
npm cache clean
Install the last version
npm install node-sass#latest
npm rebuild node-sass
Modify package.json from your project to new version of node-sass
Run
npm i
If you have another dependency that use node-sass change her version
Remove package-lock.json then npm install, again. Worked for me.
(No need to remove node modules)
I'm building a small application that allows you to upload files, store them in the cloud and analyze them with Google Cloud Vision API.
I got the uploading and storing working now, I use firebase for that, but when I try to run gcloud I run into some issues.
In the main.js file in server folder I run:
import gcloud from 'gcloud';
console.log('gcloud', gcloud);
But that causes an error in the terminal:
=> Started proxy.
=> Started MongoDB.
Unable to resolve some modules:
"memcpy" in /C/Users/Zino/Documents/Meteor Projects/find-it/node_modules/bytebuffer/dist/ByteBufferNB.js
(os.windows.x86_32)
If you notice problems related to these missing modules, consider running:
meteor npm install --save memcpy
My site does not load so I run:
meteor npm install --save memcpy
But then I get an error I'n can't find anything about in the internet:
node error log
I've been been trying to solve this issue for 2 days now, without luck. Any suggestions?
In my case, this was fixed by installing + importing specific sub-packages of google-cloud, rather than the google-cloud metapackage, which includes everything.
e.g.
$ npm install --save #google-cloud/datastore
$ npm install --save #google-cloud/storage
var config = {
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
};
var datastore = require('#google-cloud/datastore')(config);
var storage = require('#google-cloud/storage')(config);
To expand on Windows being the culprit: The build fails at 'node-gyp configure build', which has a build dependency on Visual C++ Build Tools / Visual Studio 2015 and Python 2.7 on Windows. It can build on Windows, but is not as straightforward as building on a Unix-y system due to lack of a standard C++ toolchain. The Microsoft Node.js Guidelines for Windows, which make special mention of 'running into dreaded node-gyp issues', should have all the steps needed to get the build to work.
I would like to use gulp in my Wordpress project. Is it possible to execute gulp functions outside a node JS project?
I'm running on OSx, but couldn't find anything on the internet about it. Or do I'll have to use another lib like Grunt?
Yes, the main language of your project doesn't affect whether or not your can include some node.js dependencies and run them. You will need to have gulp installed and have a gulpfile.js in your project, and then you can run it.
You could install gulp globally on the server (npm install -g gulp), but I recommend creating a package.json file (using npm init) in your project, so that your node.js dependencies are tracked in your version control, and installing gulp with npm install --save gulp (inside your project's directory). Since gulp won't be installed globally in that case, you will need to use "$(npm bin)"/gulp from a directory inside your project to run it.
I use Yeti Launch from the Zurb foundation for the same setup (no node installed on my Mac).
When you run it, it will create a Foundation frame but you can do the following:
Stop the project it creates from within its interface,
Delete the files it creates and replace with yours
Leave the project it shows in the interface
Leave the "node_modules" folder it creates
Start the project again
This will run your Gulp file.
The only issue is installing node modules. For this, I look at any error messages it gives regarding missing modules and copy these into the "node_modules" folder from Github
The short answer is no. Gulp is distributed as a npm package and has node.js as a dependency BUT that doesn't mean you can't use it outside of a node.js project.
The only real need for Gulp on a wordpress project would likely either be at the theming layer or if you were doing a custom plugin. Assuming you are making a theme, some of them use Gulp extensively.
I've used the Roots ecosystem's Sage theme successfully on a number of projects. It has node/npm dependencies but they are all included if you use the theme. Check out their Gulp file - it's probably close to what you are philosophically looking for.
I am trying to get my localhost working on my remote (mediatemple) server.
I have bundled it up and have a /myurl.com/bundle folder with the following files.
this folder contains
main.js
npm-debug.log
programs
server
How do I get this to run?
You should take a look in the README inside the bundle folder. Normally everything ist described there to start your app.
Make sure that NODEJS and MONGO is installed on your remote server. This is NOT included in your bundle as well as NODEJS is not present.
If you are running a system like debian or ubuntu normally you can do the installation with
apt-get install nodejs mongo
Make sure, that the nodejs has release v0.10.36 or v0.10.38
node --version
At the README you see the necessary ENV-VARS like MONGO_URL and PORT you need to set to start your meteor app.
If you have running a apache server already the PORT 80 is already blocked, so try PORT=3000 to start your meteor app.
Example:
MONGO_URL='mongodb://localhost:27017/yourapp' ROOT_URL="http://yourhost" PORT=3000 node main.js
If using as above you do not need to export the ENV-VARS before start
Sometime when starting, there are missing NPM – you get fiber errors
In that case
cd programs/server
npm install
and the try start again.
Good luck
Tom
(I'm writing this response assuming that you are not worried about scalability issue, respond in comment if you want to scale your app)
The best option for running a node application, which Meteor application is, is by using forever.
npm install forever
forever start simple-server.js
If you want to figure out how to see the log files and how to stop/restart your service, you can run forever --help to see all the commands.
I just started learning Meteor JS on a fresh copy of OSX. I used the Meteor install instructions to install it. Everything works well - I can install Meteor packages and run the local instance. But where is Node.js and npm? I assume it must be installed with Meteor because everything runs, but the npm and node command is not available. Am I supposed to install Node separately?
Thanks,
Kevin N.
Edit: Corrected npm in the question title which OS X keeps changing to nom.
As of METEOR#1.1.0.2, node and npm are stored in :
/home/username/.meteor/packages/meteor-tool/1.1.3/mt-os.linux.x86_64/dev_bundle/bin/
(The path depends on both the username and architecture of course).
If you're doing only Meteor dev, you won't need node on its own, you might however need npm to install Meteor related tools such as Meteor Up (mup), in which case you need to install npm separately or alias the command to use the Meteor one.