i can't install any node packages with npm install - javascript

I try to install node packeges with nmp. When i run, it says:
up to date, audited 356 packages in 7s
found 0 vulnerabilities
I see it as a dependency in my package-json like this:
"dependencies": {
"express": "*",
"nodemon": "*"
}
but there is no node_modules was installed..
Hope someone can help.
edit: I tried the commands given in the answers but it didn't work. still same
ss from editor

These commands solve the same problem and have a look at the attached links.
https://github.com/npm/npm/issues/17282
Can't install anything using "npm install"
npm install -g npm
npm cache clean
npm update
npm install

There are a few fixes to this issue.
The first one is to install the dependencies manually, as so.
$ npm install -s express nodemon
The command should install express and nodemon at the latest versions.
The second option is to run a few commands, as so (in the order given).
$ npm install -g npm
$ npm cache clean --force
$ npm update
$ npm install
Basically, these are what the commands do (from 1-4).
This installs npm from npm (sounds weird, but there is an npm package).
This command forcefully cleans out the cache of npm.
As you can tell, npm update updates npm!
Finally, this command should be run in a directory where there is a package.json file. This installs all the dependencies listed in package.json.
Don't type out the $ in the terminal examples!

Related

Gatsby - Error: Cannot find module '..\node_modules\gatsby\dist\utils\babel-loader.js'

When running gatsby develop, right after gatsby new with configurations provided in the tutorial here - https://www.gatsbyjs.com/docs/tutorial/part-1/, I am getting this error
Module build failed (from ../../my-first-gatsby-sitenode_modules/gatsby/dist/utils/babel-loader.js):
Error: Cannot find module '..\my-first-gatsby-site\node_modules\gatsby\dist\utils\babel-loader.js'
Solutions I have tried:
Delete node_modules, package-lock => npm install / yarn.
Run npm install in node_modules/gatsby.
npm -g --save babel-loader.
Please help if you have come across the error and been able to resolve it. TIA.
Run npm install in node_modules/gatsby.
npm install must be run in the root of your project, not inside node_modules.
Delete node_modules, package-lock => npm install / yarn.
You should only choose npm or yarn, not both.
Try the following:
Run the following: npm install --save gatsby-cli
If you have many audit warnings before the previous command, run: npm audit fix (in the root of your project).
Remove your node_modules and reinstall the dependencies in the root of your project by: npm install

Error: Node Sass version 5.0.0 is incompatible with ^4.0.0 (After using this command : "npm install node-sass#4.14.1" still throws a same error

enter code here I've created a react project, using command : npm create-react-app
Installed
node-sass: "^5.0.0"
react: "^17.0.1"
Then I tried to import blank index.scss file to index.js componenet
Screenshot Code of Index.js
[Code of Index.js][1]
Screenshot of Localhost
image of localhost having the description of error
Special Note :
After getting this I Have uninstall node-sass and installed again with version4+. Please find below screenshot of cmd.
npm uninstall node-sass
npm install node-sass#4.14.1
cmd screenshot
Please uninstall it an then install the last version of 4:
npm uninstall node-sass
npm install node-sass#4.x
npm uninstall node-sass
npm install node-sass#4.14.1
Or, if using yarn (default in newer CRA versions)
yarn remove node-sass
yarn add node-sass#4.14.1
Do not go back. That’s quitting.
rm -rf ./node_modules ./package-lock.json
Then
npm i
Done ✅
Try installing sass instead of node-sass.
yarn remove node-sass
yarn add sass

npm script strange behavior using npm terminal

I have this in my package.json
"devDependencies": {
"chromedriver": "^2.37.0",
"geckodriver": "^1.11.0",
"nightwatch": "^0.9.20",
"selenium-server": "^3.11.0"
},
"scripts": {
"e2e": "nightwatch -c tests/nightwatch.conf.js -e chrome"
}
and I'm able to execute npm run e2e
But in my terminal when I do node nightwatch -c tests/nightwatch.conf.js -e chrome I got this error
Error: Cannot find module 'C:\Users\James\Documents\sample_project\nightwatch'
Just curious, what's the problem? I doubt I know how npm and node work now.
When you do 'node nightwatch' it should go into node_modules folder and look for nightwatch, but instead its looking in the root directory.
You could cut the nightwatch folder in node_modules and move it to the same directory as package.json. Give it a try!
Is nightwatch module installed globally? If not, then install this module globally first using npm install nightwatch -g. As you are using this module inside CLI command, hence this must be installed globally in the system.
Sometime there might be issue with npm cache. Try to clean up the npm cache using:
npm cache verify
npm cache clean --force
npm cache clear --force
Then you can run npm install and npm install nightwatch -g again, just to make sure all modules are installed.
Moreover, you can try to use --verbose in your command like:
node nightwatch.js --verbose
And see the output, may be this help to debug the issue.

npm Error! ENOENT: no such file or directory .dezalgo.DELETE'

Whenever I try to do anything with my NPM I keep on getting this error.
I try to install npm install -g --save vue-draggable
I have uninstalled node and npm and re installed and constantly having this issue.
npm ERR! path /Users/victor/Desktop/myprog/node_modules/jquery/node_modules/npm/node_modules/dezalgo
NPM Verson: 5.6.0
Node: v8.9.1
To anyone having this problem, its because NPM is version 5.6.0
Downgrade to:
Sudo npm install -g npm#4.6.1
I don't think that the accepted solution will solve the issue...
Somehow a dependancy representation in package-lock.json is wrongly described.
Removing the file package-lock.json and npm install could solve the issue.
I recommend that you use the latest version of npm : npm install npm#lastest.

"Npm install --global" and "--save" together?

I was wondering if makes any sense to use in the npm install command the --global and the --save parameters all together. For example:
npm install gulp -g -s
As far as I know there is no package.json in the npm system folder, so I suppose the answer is "no", but I want to clear all doubt.
The npm install command does not support installing a module both globally and save it to the package.json in one step.
There is, however, a way to install a module globally indirectly. The package.json supports a preinstall property like so:
"scripts": {
"preinstall": "npm install -g gulp"
}
As soon as you execute npm install, gulp will be installed globally. Please note that your current user then needs permission to write to your global node module directory.

Categories