I want to install the bcrypt package and im using the "npm install bcrypt --python=python2" and i can this after i run it:
bcrypt#5.0.0 install C:\Users\User\node_modules\bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
[bcrypt] Success: "C:\Users\User\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" is installed via remote
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\User\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\User\package.json'
npm WARN User No description
npm WARN User No repository field.
npm WARN User No README data
npm WARN User No license field.
+ bcrypt#5.0.0
updated 1 package and audited 130 packages in 2.951s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
I don't get any module in atom.
This is an error that tells you that current folder you are working in does not have a node project set up, its missing the necessary package.json file (every node project has one and needs one).
There are 2 types of "install" with npm, first is global that that you mark with -g flag (npm install bcrypt -g), this will install whatever package into global node modules that can be executed from the node command line, the second one is installing / adding it to your project.
In order to add anything to your project you need to create your project, create a folder for your project, open cmd line and navigate to the folder, and run npm init, this will create a package.json file (after you answer few questions), then npm install whatever will add the package automatically to the package.json file. (there is also a --save-dev flag that adds node module to dev dependencies)
In my javascript project I want to freeze the dependencies. For this I'm using npm-shrinkwrap https://docs.npmjs.com/cli/shrinkwrap
I do the things that are written in the doc, and it works, but I can't find any evidence that the installation really uses data from file npm-shrinkwrap.json
Here is a more detailed explanation.
I have a super simple js project:
bessarabov#air:~/shrinkwrap$ ls
package.json
bessarabov#air:~/shrinkwrap$ cat package.json
{
"dependencies" : {
"express" : "4.14.0",
"moment" : "2.14.1"
}
}
Then I run npm install (here is the log — https://gist.github.com/bessarabov/9920d6dcb1cd71e504c6fe561e39643f ) And then I run:
bessarabov#air:~/shrinkwrap$ npm shrinkwrap
wrote npm-shrinkwrap.json
So, after I run this 2 commands I get new directory node_modules and a new file npm-shrinkwrap.json.
bessarabov#air:~/shrinkwrap$ ls
node_modules npm-shrinkwrap.json package.json
Then I delete the installed libs: rm -rf node_modules/ and run npm install again. And the log is exaclty the same that was without npm-shrinkwrap.json ( https://gist.github.com/bessarabov/33c9421744582501482e4f00453f9d38 )
So, I'm not sure the second npm install really uses data from npm-shrinkwrap.json file. I want to find a way to see in the log that npm-shrinkwrap.json was used.
I'm using:
bessarabov#air:~/shrinkwrap$ npm --version
3.3.12
bessarabov#air:~/shrinkwrap$ node --version
v5.3.0
But I've also tried node 6.5.0 and the result is the same.
I have the following scripts section in my projects package.json:
"scripts": {
"seed": "node bin/seed",
"test": "echo \"Error: no test specified\" && exit 1"
},
If i run $ npm test I get this:
>npm test
> node-mongo-seeds#0.0.1 test C:\Users\m089269\WebstormProjects\node-mongo-seeds
> echo "Error: no test specified" && exit 1
"Error: no test specified"
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
If i run $ npm seed, I get this:
npm seed
Usage: npm <command>
where <command> is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, issues, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, repo, restart, rm,
root, run-script, s, se, search, set, show, shrinkwrap,
star, stars, start, stop, submodule, tag, test, tst, un,
uninstall, unlink, unpublish, unstar, up, update, v,
version, view, whoami
npm <cmd> -h quick help on <cmd>
npm -l display full usage info
npm faq commonly asked questions
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
C:\Users\m089269\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#1.4.3 C:\Program Files\nodejs\node_modules\npm
Why does it recognize my test script but not my seed script?
EDIT
When I try npm run-script seed I get this error which is expected because I don't pass in a -d param:
$ npm run-script seed
> node-mongo-seeds#0.0.1 seed C:\Users\m089269\WebstormProjects\node-mongo-seeds
> node bin/seed
Populate mongo from a set of .json files.
Usage: $ node seed
Options:
-d The path to your mongo db [required]
Missing required arguments: d
npm ERR! node-mongo-seeds#0.0.1 seed: `node bin/seed`
npm ERR! Exit status 1
...
When I try npm run-script seed -d "localhost/ease" I get this error.
npm run-script seed -d localhost/ease-dev
npm info it worked if it ends with ok
npm info using npm#1.4.3
npm info using node#v0.10.26
npm ERR! Error: ENOENT, open 'C:\Users\m089269\WebstormProjects\node-mongo-seeds\node_modules\seed\package.json'
...
Why is it looking for a package.json in node_modules\seed? Seed is not even a dependency.
From the documentation:
npm supports the "scripts" member of the package.json script, for the following scripts:
prepublish: Run BEFORE the package is published. (Also run on local npm install without any arguments.)
prepare: Run both BEFORE the package is packed and published, on local npm install without any arguments, and when installing git dependencies (See below). This is run AFTER prepublish, but BEFORE prepublishOnly.
prepublishOnly: Run BEFORE the package is prepared and packed, ONLY on npm publish.
prepack: run BEFORE a tarball is packed (on npm pack, npm publish, and when installing git dependencies).
postpack: Run AFTER the tarball has been generated and moved to its final destination.
publish, postpublish: Run AFTER the package is published.
preinstall: Run BEFORE the package is installed
install, postinstall: Run AFTER the package is installed.
preuninstall, uninstall: Run BEFORE the package is uninstalled.
postuninstall: Run AFTER the package is uninstalled.
preupdate: Run BEFORE the package is updated with the update command.
update, postupdate: Run AFTER the package is updated with the update command.
pretest, test, posttest: Run by the npm test command.
prestop, stop, poststop: Run by the npm stop command.
prestart, start, poststart: Run by the npm start command.
prerestart, restart, postrestart: Run by the npm restart command. Note: npm restart will run the stop and start scripts if no restart script is provided.
Additionally, arbitrary scripts can be run by doing npm run-script <stage> <pkg>.
You can see the reason why your npm test script works is because npm test is a built-in command. You must use npm run-script if you want to execute a script that is not executed by a built-in npm command.
Custom scripts declared in the package.json can be ran with the npm run <your-script> form in your shell.
Try npm run seed or npm run test
To execute the custom scripts in package.json using below
npm run-script seed
or
npm run-script < custom script >
or you can use
npm run < custom script >
I have installed mean.io and ran sudo npm install. Actually following commands in sequence
sudo npm install -g meanio
mean init yourNewApp
cd yourNewApp
sudo npm install -g bower
sudo npm install
It is supposed to download and install angularjs libraries into public/system/lib. After doing the above steps public /system/lib is not created due to which when I start the application I get the error
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open '/home/santhosh/dev/scaleqa/mean_tut/old mean/temp/myapp/public/system/lib/bootstrap/dist/css/bootstrap.css'
[nodemon] app crashed - waiting for file changes before starting...
Is it something to do with certain npm/angularjs server being down. I have faced this problem earlier also but got fixed on 2nd try and I didn't bother to do more research. This became a big issue when I try to pull my repo into cloud and start the application. public/system/lib is added in .gitignore by default and is expected to be created during npm install.
I get following warnings with sudo npm install
npm WARN package.json mean-connect-mongo#0.4.3 No repository field.
npm WARN cannot run in wd mean#0.3.3 node node_modules/bower/bin/bower install (wd=/home/santhosh/dev/scaleqa/mean_tut/old mean/temp/myapp)
this is link to package.json
The problem maybe related to running npm install as sudo, which can cause problems. As mentioned in another stack overflow question, this can be worked around in a couple ways. But because it looks like this is being run from your home directory, you really shouldn't need to run npm install as root.
Try to issue the same commands, but the last without sudo:
sudo npm install -g meanio
mean init yourNewApp
cd yourNewApp
sudo npm install -g bower
npm install
Note that the reason you may need to run npm install -g <package> using sudo is because by default npm uses /usr/local for global installs, which can be a restricted directory. However, when you install a package locally (without the -g flag) you should not need to run as root.
I'm trying to build the backbone boilerplate project found here: https://github.com/backbone-boilerplate/backbone-boilerplate
I'm having some issues getting it to build properly. Here are the steps I've done which are the steps on the backbone-boilerplate wiki:
git clone https://github.com/backbone-boilerplate/backbone-boilerplate.git
cd backbone-boilerplate
sudo npm install -gq bower
sudo npm install -q
sudo npm install -gq grunt-cli
sudo grunt
At this point I get:
>> Local Npm module "grunt-cli" not found. Is it installed?
Warning: Task "requirejs" not found. Use --force to continue.
Aborted due to warnings.
Any ideas how to get this to build properly?
Specifying depth seems to work:
$ git clone --depth 1 https://github.com/backbone-boilerplate/backbone-boilerplate.git
$ npm install
$ grunt
Also you may want to restart your terminal if that is your first time installing grunt-cli
You're running grunt under elevated privileges. Our documentation for building here:
https://github.com/backbone-boilerplate/backbone-boilerplate#build-process
... has you run that command under your own user. Give that a shot!
You need to ensure you build dependencies with bower, not just the node dependencies.
Getting Started
# Using Git, fetch only the latest commits. You won't need the full history
# for your project.
git clone --depth 1 https://github.com/backbone-boilerplate/backbone-boilerplate
# Move the repository to your own project name.
mv backbone-boilerplate my-project
Updating Dependencies
# Install global dependencies. Depending on your user account you may need to
# gain elevated privileges using something like `sudo`.
npm install -g grunt-cli bower
# Optionally install coveralls (integration is baked in with Travis CI).
npm install -g coveralls
# Install NPM dependencies.
npm install
# Install Bower dependencies. ** THIS IS THE ONE YOU'VE MISSED **
bower install
Build Process
# To run the build process, run the default Grunt task.
grunt
# Run a build and test the now optimized assets.
grunt default server:release
If you have node installed correctly this should work like a charm.