I want to install this module: node-poormansmysql.
My nodejs application is installed in C:\Program Files\NodeJS\.
I have here the folder - node_modules.
Here I added a folder - node-poormansmysql. In this folder I copied the content from github.
I still have the error - Can not find module - node-poormansmysql
Where am I going wrong?
Try to copy to C:\Users\{username}\node_modules
Or just type in cmd "C:\Program Files\NodeJS\npm.cmd" install node-poormansmysql
The problem is that node will look for an index.js in the folder (or a package.json) and this library have not been packaged as a module.
So what you need to do is re-name node-poormansmysql.js to index.js
Also make sure you get all the dependencies.
Related
I have a serverless aws app within a context of many other ones. All of the node_modules are shared in a parent folder, and it works fine with deploys and invoke functions, not with invoke local. This is my structure:
main/
- node_modules
- serverless
- app1
- app2
- serverless.yml
serverless.yml file settings:
package:
include:
- ../../node_modules/**
The problem is whenever I try to run sls invoke local I got a error messages due to package not found. So, the workaround is to npm install --save every package that is outside of my path.
If you have found a solution, not a workaround (like mine) please share :).
It was so obvious I wanted to delete my question, but I'll leave the answer here>
just go to the folder that contains your node_modules, you'll find a package.json there, and run npm install --save for the new packages you need.
cd ../../
npm install --save missing_packages
your serverless.yml include should consider it when running local with no issues.
Violá!
I am working on the Laravel project, and intend to use Vue.js as its client-side scripting. When I searched the internet, I found that I had to use the npm install command. My question is if I run the order, will it affect the project I'm working on?
For example, in the directory structure or variable section?
It will change only package.json and /node_modules folder (it will download vue.js last version package into this folder) in your root directory. But it won't affect your existing codebase until you don't use them via importing or accessing it. It is like installing a package with composer, but not using it. The downloaded package will stay in /vendor folder and package name in composer.json, composer.lock
Is it possible for a composer package to create a folder (or folders) in the root directory of the project?
For example:
/ansible
/application
/public
/composer.json
/composer.lock
I run composer install to install my package (framework).
Can this framework create the folders /logs in my root directory?
You might want to have a look at https://getcomposer.org/doc/articles/scripts.md and check the post-install-cmd event name and supply your own script to create your needed directories.
I 'm using Spring Boot and Angularjs with bower plugins.
In static directory, 'bower_components' use many space.
How to optimize build please (without extra plugins files)?
You can use bower-installer which is a node package to control which files to be copied to your static resources folder from the downloaded distribution package folder. Please look into below link.
https://www.npmjs.com/package/bower-installer
I followed below steps to select which files to be copied to my lib folder
1) Install bower-installer by runnnig npm install -g bower-installer command
2) Create 'bower_components' folder outside of your src folder.
3) Edit bower.json configuration file(in the 'bower_component's folder ) and specify path for each js library components.
4) Run bower-installer from terminal
Please let me know if you need more details.
I'm using the Node.js for Windows package (currently 0.4.2) downloaded from here:
http://www.rafaljonca.org/d/nodejs-windows
It works great - I can install packages with npm, and run packages like node-inspector, express, etc. The problem is that I can only run those packages if I'm in the bin directory of the distro. I run the setenv.cmd file, which adds bin to the path, but attempting to actually invoke a package (like install another package using npm) when I'm not in the bin path results in the following exception.
Error: Cannot find module '/npm '
at Function._resolveFilename (module.js:299:11)
at Function._load (module.js:245:25)
at Array.<anonymous> (module.js:402:10)
at EventEmitter._tickCallback (node.js:108:26)
I've tried setting the NODE_PATH environment variable to my node package dir, but that doesn't. help.
Though the question is 4 months old I've run into the same issue recently, so hopefully this is still useful.
There is a bug in the runnode.cmd file - there are 2 spaces at the end of line 4, after 'convArg=%%i'. If you remove them, the script will work.