when i run the command npx create-strapi-app#latest my-project i find this error Cannot find module 'fs-extra' what should i do?
I installed the fs-extra module but it does not work, then I typed these two commands npm install -g npm-reinstall, npm install -g npm#latest it still does not work, if you can offer me a solution
I'd like to know if Javascript's npm installs dependencies OS-wide like Python's pip (if pip is not using a virtualenv), or if npm installs dependencies more like Java's mvn which stores the things in a local pom.xml file (to me mvn feels more like if it was always in a virtualenv if compared to pip).
So I mainly want to know if it's OS-wide installs or local installs that are performed with npm.
Both!!
npm install -g PACKAGE_NAME will install the package globally.
npm install PACKAGE_NAME will install the package locally in the current folder, under node_modules/.
npm install --save PACKAGE_NAME will install the package locally and save it as a dependency in your package.json.
Checkout https://www.sitepoint.com/beginners-guide-node-package-manager/
if you execute just npm install <dependency name> you are telling node to install package only on your current directory this will also create node_modules in current directory you are installing.
and if you execute the npm install -g <dependency name> with the -g you are saying that you want the node to install the dependency globally and the package will be save on the global node_modules. and most of the global dependencies can be access using CLI
example.
$ npm install mocha
you can execute the command in the current directory execute the npm install or where the node_module is
$ $PWD/node_modules/.bin/mocha -v
if you
$ npm install -g mocha
you can execute the command anywhere in your directory on the terminal
$ mocha -v
I did $ npm install gulp -g and I am getting this error
-bash: /usr/local/bin/gulp: No such file or directory
node version:
v5.0.0
I am using OSX.
what could be happening?
as said in the gulp guide you have to install cli and than you need to have gulp in your project dependencies in order to run.
So first:
npm install --global gulp-cli
And than inside your project
npm install --save-dev gulp
I replied to a similar question here
hope this helps
In my project directory, I installed Grunt by using the following command:
npm install grunt
...after that I did Grunt server in my project directory but it gives me command not found error.
Raj$ grunt server
-bash: grunt: command not found
And:
npm install grunt
npm WARN package.json BID-2.0#0.0.0 No description
npm WARN package.json BID-2.0#0.0.0 No repository field.
npm WARN package.json BID-2.0#0.0.0 No README data
How can I fix it?
You need to install Grunt's command line interface (CLI) globally as well.
From their site:
npm install -g grunt-cli
You may need to use sudo command (for OSX, *nix, BSD etc) or run your command shell as Administrator (for Windows) to do this.
This will put the grunt command in your system path, allowing it to be run from any directory.
You will have to install grunt after installing node / npm with: npm install -g grunt. Then it will be available at the cmd.
After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.
When looking under the node_modules/.bin/ directory, I can see the gulp executable there.
Is there something wrong with my npm installation?
That's perfectly normal.
If you want gulp-cli available on the command line, you need to install it globally.
npm install --global gulp-cli
See the install instruction.
Also, node_modules/.bin/ isn't in your $PATH. But it is automatically added by npm when running npm scripts (see this blog post for reference).
So you could add scripts to your package.json file:
{
"name": "your-app",
"version": "0.0.1",
"scripts": {
"gulp": "gulp",
"minify": "gulp minify"
}
}
You could then run npm run gulp or npm run minify to launch gulp tasks.
I solved the issue without reinstalling node using the commands below:
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli
I actually have the same issue.
This link is probably my best guess:
nodejs vs node on ubuntu 12.04
I did that to resolve my problem:
sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
I solved the issue removing gulp and installing gulp-cli again:
rm /usr/local/bin/gulp
npm install -g gulp-cli
if still not resolved try adding this to your package.js scripts
"scripts": { "gulp": "gulp" },
and run npm run gulp
it will runt gulp scripts from gulpfile.js
Installing on a Mac - Sierra - After numerous failed attempts to install and run gulp globally via the command line using several different instructions I found I added this to my path and it worked:
export PATH=/usr/local/Cellar/node/7.6.0/libexec/npm/bin/:$PATH
I got that path from the text output when installing gulp.
Tried with sudo and it worked !!
sudo npm install --global gulp-cli
I'm on lubuntu 19.10
I've used combination of previous answers, and didn't tweak the $PATH.
npm uninstall --global gulp gulp-cli
This removes any package if they are already there.
sudo npm install --global gulp-cli Reinstall it as root user.
If you want to do copy and paste
npm uninstall --global gulp gulp-cli && sudo npm install --global gulp-cli
should work
I guess --global is unnecessary here as it's installed using sudo, but I've used it just in case.
in my case there was only on issue, just put "gulp":"gulp" in the script portion, of package.json, and then use command npm run gulp.