I am running this npm i nodemon -D and getting a command failed error. Please click on the above image to view the error.
I tried deleting package.json, removing node_modules, and installing it again, but the error persists. I have been attempting a bunch of solutions to resolve this issue but I don't know why it gives this error again and again.
Error image: This error is coming on my VS code
The issue is resolved by using command npm config set script-shell cmd
and then installing nodemon package by npm install nodemon
Lastly, don't forget to reverse the changes and set it back to default by using npm config set script-shell powershell
Related
Hey guys I am getting error even after executing the above command if there is any other command to resolve this error please let me know
Error: Cannot find module 'express-hbs'
Before You start using the package - express-hbs, You must install it properly, most likely You installed the package in the wrong place, outside of the project folder.
In the root project folder, run the command:
npm install express-hbs
try again to run nodemon
The \AppData\Roaming\npm\node_modules#angular\cli\bin\ng.js file cannot be opened and it gives an error whenever I try to use an ng command anywhere, be it in an angular project or elsewhere.
The error is as follows:
Script: (my username)\AppData\Roaming\npm\node_modules#angular\cli\bin\ng.js
Line: 1
Character: 1
Error: Invalid Character
Code: 800A03F6
Source: Compilationerror Microsoft Jscript
What I have tried:
using ng commands in different project -- same error
reinstall npm, angular, removing the node modules in all combinations
Setting the angular path in the environment variables
What happened before:
ng command was missing possibly due to stuff related to python install. This error is replaced with my current problem when reinstall is done.
I have reinstalled everything to the fullest extent but the problem keeps persisting.
I can use my angular project by running 'npm run ng serve' and that weirdly works.
Does anyone have ANY idea what might cause this problem
EDIT:
I have somehow managed to resolve the problem but I have no clear answer what was the cause of it all. I did reinstall nodeJS on my computer which MIGHT have been broken during another project.
Remove the user environment variable
C:\Users\AppData\Roaming\npm\node_modules#angular\cli\bin
It worked for me after losing a day of life looking for a solution
In my case this error occured because of permissions on windows. Try to run cmd as Administrator.
Deleting and reinstalling node.js did not fix it. The issues started when I installed latest CLI which is 13.
I removed npm folder from C:\Users\username\AppData\Roaming then I installed the previous version
npm install -g #angular/cli#12.0.0
I do not get the error anymore.
What worked for me is setting this path:
set path=%PATH%;C:\Users{username}\AppData\Roaming\npm
Firstly you need to set the path of npm
$ npm config get prefix
make sure path matches with npm config get prefix
export PATH=/usr/local/share/npm/bin:$PATH
in windows you can set by advance system settings -> Environment variable -> set path.
Restart you system then do this -
$ npm install -g #angular/cli#latest
get package version
$ ng version
create workspace
$ ng new my-project
run the application
$ cd my-project
$ ng serve
i got an error while trying to create react native app using npx npx
react-native init AwesomeProject
like the docs said. But i got an error messages
npm ERR! code ENOLOCAL npm ERR! Could not install from
"Indigo\AppData\Roaming\npm-cache_npx\3192" as it does not contain a
package.json file.
npm ERR! A complete log of this run can be found in:
C:\Users\Durio
Indigo\AppData\Roaming\npm-cache_logs\2020-07-08T08_20_54_191Z-debug.log
Install for react-native#latest failed with code 1
i know it's not from the npx because i tried to create react app with npx and it works. Am I the only one who had this?
This is an issue in node which is caused by white space in user name between first-name and last-name in windows.
run the following command after replacing firstname with your windows user firstname in command prompt with administrator access
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global
I had you try npm cache clear and if using windows you can run command npx react-native init AwesomeProject in Command promt using Run as Administrator
I have faced the same issue, do nothing just a quick fix.
first, run the command npm i react-native#latest -g then create your project with your command i.e npx react-native init myProject
we should check the android SDK path on environment variable. Make sure there is no white space on the SDK path and platform-tools path
Running npm 6.11.3, node-gyp 5.0.3, VS2019 on Windows 10 v1903, getting this error:
Cannot find module %AppData%\npm\node_modules\node-gyp\bin\node-gyp.js (where %AppData% is expanded to the actual user-specific path).
The error only happens if the build is invoked via npm, i.e.:
npm run build
The package.json file scripts section:
"scripts": {
...
"build": "node-gyp build",
}
If node-gyp build is invoked manually outside npm context, the error is gone.
How do I get rid of the error and still use npm scripts for making builds?
Figured it out.
After upgrading to node-gyp 5 on a Windows 10 build system, I started getting the infamous Error: Cannot find module ... npm\node_modules\node-gyp\bin\node-gyp.js, caused by node_modules\npm-lifecycle\node-gyp-bin being pushed on top of my PATH by npm, exactly as described here.
None of the existing remedies I've found and tried could solve this issue for me, including installing the latest windows-build-tools. Here's exactly what I tried, in the following order:
manually clean up the mess and duplicates in System PATH and User PATH environment vars
reboot
choco unistall nodejs
rd /s %AppData%\npm\
rd /s %AppData%\npm\
choco install nodejs
npm install -g npm#latest
npm install -g node-gyp#latest
npm install -g typescript#latest
I was still getting the missing node-gyp.js error. What did help was to properly set npm config set node_gyp to point to the correct node-gyp.js, as suggested here. Yet somehow the script from that thread didn't work properly for me (as well some other PowerShell/Batch scripts I tried).
Eventually, I've come up with the following PowerShell 6 one-liner that did the trick for me:
pwsh -Command npm config set node_gyp "`u{22}$(Join-Path $(npm root -g) -ChildPath 'node-gyp\bin\node-gyp.js')`u{22}"
Hope this helps others and future-me. I'd still recommend going through the above bullet list for clean troubleshooting.
So ultimately, I am trying to install gulp by following this tutorial http://travismaynard.com/writing/getting-started-with-gulp, and I was having a lot of problems initially. I kept getting the error that "gulp is not recognized as an internal or external command", which is confusing to me because I found that by running npm ls that gulp had been installed properly. The command wasn't being recognized even after restarting command prompt. I found an article online http://blog.webbb.be/command-not-found-node-npm/ that I may have installed gulp in my local folder other than the global node_module folder. However, when I tried to reset the npm folder with npm config set prefix usr/local/, I received errors. If anyone can walk me through getting the global NPM folder set up and getting the gulp command to work properly, that would be much appreciated.
Try running command prompt as administrator,
or sudo since you seem to be on unix,
you install a package globally by using npm -g,