I want to make a bug fix in an NPM library.
How to make my software using package.json to refer to my version of the library (probably a directory on my disk with the library) rather than to the "standard" version of the library from npmjs.org, so that I would be able to debug my version of the library?
You just need to run npm install like you normally would. The only difference is that instead of doing npm install <package-name>, you're going to do npm install /path/to/local/package
Here's an article explaining in more detail
I would like to develop a JS test library for client & node.
I need to develop for two different repo's?
Lets take for example QUnit:
for client side I will use:
https://code.jquery.com/qunit/qunit-2.3.0.js
But for node develop, I will use :
npm install qunitjs
Those are 2 different code repo's, aren't?
For the example, lets puts aside the testrunner, etc..
Thanks!
Originally the "npm" used to stand for the "Node Package Manager".
Currently, the npm Registry is a public collection of packages of open-source code for Node.js, front-end web apps, mobile apps, robots, routers, and countless other needs of the JavaScript community.
And npm is the command line client that allows developers to install and publish those packages.
See: https://www.npmjs.com/about
So you can use npm to package front-end code just like you can use npm to package Node code. Sometimes it makes sense to publish two packages - one for frontend and one for backend - but sometimes you can have just one.
For packaging frontend code there are more options like Bower: https://bower.io/
For packaging Node code the most popular choice is npm but you can install code directly from GitHub or other git repos.
As an example you can see my module tco that is on npm:
https://www.npmjs.com/package/tco
But also on GitHub:
https://github.com/rsp/node-tco
So you could install it with npm either from the npm Registry or from GitHub:
npm install tco # <-- from npm registry
npm install rsp/node-tco # <-- from github
Additionaly you can use it on the frontend from the CDN available for all code on GitHub:
<script src="https://cdn.rawgit.com/rsp/node-tco/v0.0.12/tco.min.js"></script>
If you want your code available on that CDN as well, see RawGit:
https://rawgit.com/
I have installed grunt and grunt-cli globally using sudo npm install -g grunt... commands.
My working folder is `/opt/web', please don't ask why :)
Checking grunt version inside `/opt/web' works:
$ grunt --version
grunt-cli v0.1.13
However, I can't actually run a grunt task from there:
$ grunt
grunt-cli: The grunt command line interface. (v0.1.13)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project.
If I install grunt locally, it then asks to install all it's dependencies locally (that are already installed globally (!)).
This behavior seems strange to me.
My question is:
Is this a bug or a feature? Is this by design that grunt wants to work with locally installed things only?
This is by design. See the grunt-cli readme.
The cli doesn't do anything except find and run a local copy of grunt.
This means that each project can use a version of grunt that the project specifies and is know/tested to work correctly. Given the number of critical things grunt can do, this compatibility promise is a big deal.
There is also a good blog post on the node site that talks a bit more about module installation locations.
I am currently working on JavaScript and want to design unit test for JavaScript I am using google-JS-Test
http://code.google.com/p/google-js-test/
I have downloaded gjstest-1.0.7
I have installed all the prerequisites need.
http://code.google.com/p/google-js-test/wiki/Installing#Prerequisites
but when I install google js test using
$ cd gjstest-1.0.7
$ make
I got following errors
g++ -DHASH_NAMESPACE=__gnu_cxx -lrt -I. -I/usr/include/libxml2 -DDEFAULT_DATA_DIR=/usr/local/share/gjstest -c -o gjstest/internal/cpp/v8_utils.o gjstest/internal/cpp/v8_utils.cc
gjstest/internal/cpp/v8_utils.cc:33: error: ‘v8::StackFrame’ has not been declared
gjstest/internal/cpp/v8_utils.cc:34: error: ‘v8::StackTrace’ has not been declared
gjstest/internal/cpp/v8_utils.cc: In function ‘void gjstest::ConvertToStringVector(const v8::Handle<v8::Value>&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)’:
gjstest/internal/cpp/v8_utils.cc:60: error: no matching function for call to ‘v8::Array::Get(uint32&)’
/usr/include/v8.h:1161: note: candidates are: v8::Local<v8::Value> v8::Object::Get(v8::Handle<v8::Value>)
make: *** [gjstest/internal/cpp/v8_utils.o] Error 1
It seems like v8 is not install correctly
I have installed V8 using commands like
sudo apt-get install libv8-2.0.3
sudo apt-get install libv8-dbg
sudo apt-get install libv8-dev
And also by downloading it
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
make dependencies
scons
But still getting these errors
So if any one has installed and used Google Js or installed v8, kindly guide me on how should I solve this problem.
I am using Ubuntu 10.04.
Any help will be appreciated.
This is indeed caused by trying to build gjstest against a very old version of libv8.
I checked out and built a more recent libv8 on ubuntu 10.04 by following the instructions here:
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
make depdendencies
make native library=shared
cp out/native/lib.target/libv8.so /usr/local/lib/libv8.so
cp include/v8.h /usr/local/include/v8.h
cp include/v8stdint.h /usr/local/include/v8stdint.h
After which gjstest compiled and ran without further surprises.
I created a new Rails project using rails 3.1.0.rc4 on my local machine but when I try to start the server I get:
Could not find a JavaScript runtime. See here for a list of available runtimes. (ExecJS::RuntimeUnavailable)
Note: This is not about Heroku.
Installing a javascript runtime library such as nodejs solves this
To install nodejs on ubuntu, you can type the following command in the terminal:
sudo apt-get install nodejs
To install nodejs on systems using yum, type the following in the terminal:
yum -y install nodejs
Note from Michael 12/28/2011 - I have changed my accept from this (rubytheracer) to above (nodejs) as therubyracer has code size issues. Heroku now strongly discourage it. It will 'work' but may have size/performance issues.
If you add a runtime, such as therubyracer to your Gemfile and run bundle then try and start the server it should work.
gem 'therubyracer'
A javascript runtime is required for compiling coffeescript and also for uglifier.
Update, 12/12/2011: Some folks found issues with rubytheracer (I think it was mostly code size). They found execjs (or nodejs) worked just as well (if not better) and were much smaller.
n.b. Coffeescript became a standard for 3.1+
Add following gems in your gem file
gem 'therubyracer'
gem 'execjs'
and run
bundle install
OR
Install Node.js to fix it permanently for all projects.
sudo apt-get install nodejs does not work for me. In order to get it to work, I have to do the following:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Hope this will help someone having the same problem as me.
On the windows platform, I met that problem too
The solution for me is just add
C:\Windows\System32
to the PATH
and restart the computer.
I had this issue on a Windows machine and installing node.js was the solution that finally worked for me. This came after trying multiple other routes including trying to get 'therubyracer' working. Though the github for node.js suggests that installation on windows is still unstable, the website at http://nodejs.org/ had a Windows installer which worked perfectly.
if you already install nodejs from source for example, and execjs isn't recognizing it you might want to try this tip: https://coderwall.com/p/hyjdlw
If all fails you can try
# aptitude install nodejs
as root. You can test your install with the following command:
# node -v
If you want to install NPM, please refer following link. Hope it helps.
On CentOS 6.5, the following worked for me:
sudo yum install -y nodejs
Install a Javascript runtime
The error is caused by the absence of a Javascript runtime on your local machine. To resolve this, you'll need to install NodeJS.
You can install NodeJS through the Node Version Manager or nvm:
First, install nvm:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
Install Node through nvm:
nvm install 5.9.1
This will install version 5.9.1 of Node.
I ran into this issue using Phusion Passenger (running as an nginx module) on a Redhat server. We already had a Javascript runtime installed. Other Rails apps in the same parent directory worked fine.
It turned out that we had a permissions issue. Run "ls -l" and see if the folder has the same owner and group as other working apps on the system. I had to run chown and chgrp on the folder (with the recursive switch) to fix it.
I hope you have pre-installed nodejs || nmv.
My solution does not require gem setup or installing 'node with sudo apt" when you already have nvm.
All you need is to edit DesctopEntry of RubyMine. for that we will have those small steps:
Go to usr/share/applications
Open in any editor (i use vim ) Rubymine DesktopEntry vim RubyMine
Edit line 6 (starts with Exec). You shoud add to beginning /bin/bash -i -c. So your line should look like this
Exec=/bin/bash -i -c "/home/USERNAME/rubymine/RubyMine-2019.1.2/bin/rubymine.sh" %f
Done! You are glorious!
As a benefit all your environment variables are now available for RubyMine. So you feel no pain with additing them.
On MacOS try running:
brew install node
brew link node
To force the link and overwrite all conflicting files:
brew link --overwrite node
node -v