Yes
I have cleared both node_modules and package-lock.json via Powershell.
After npm install -g npm@latest
npm -v
6.9.0
After npm install && npm start
'react-scripts' is not recognized as an internal or external command...
Troubleshoot, create-react-app, react-scripts, "not recognized as an internal or external command", npm scripts
npx create-react-app --info
npx: installed 63 in 14.404s
Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
Binaries:
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.17763.1.0
Internet Explorer: 11.0.17763.1
npmPackages:
react: ^16.8.4 => 16.8.4
react-dom: ^16.8.4 => 16.8.4
react-scripts: 2.1.8 => 2.1.8
npmGlobalPackages:
create-react-app: Not Found
(Write your steps here:)
It is expected that the development server should launch through the default browser (firefox) on port 3000.
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
2019-03-08T21_07_52_062Z-debug.log
I don't have project code yet because I can't get the project to launch :(
Strangely enough, I have another React project that was created with create-react-app ~6 months ago in the same parent directory as the test project and I don't have any problems with it.
UPDATE
After hitting this post https://github.com/facebook/create-react-app/issues/6197 the OP mentioned that running npx react-scripts start was able to start the development server. This is true for me as well, if this is any help for others. Still no luck with npm start. I have also tried this procedure with yarn and get the same results :(
@ianHunterClipd is "react-scripts" present in your dependencies/devDependencies ?
Yes, react scripts is listed as a dependency in my package.json file
...
"dependencies": {
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-scripts": "2.1.8"
}
...
As another test I spun up an ec2 instance with Ubuntu and (successfully) created a project with create-react-app. Pushed that project to git and pulled it back down to my local dev environment and encountered the same issue. In my mind it seems like this is some sort of PATH issue but the PATH listed in the debug log seems like it should be sufficient. Cheers,
Ian
Took another stab at this problem today and made some headway. After doing more research about npm scripts and package.json files, I eventually tried running the react-scripts script from node-modules/.bin manually and whalla! the development server launches as desired. At least I can work on my project now :P
I am still curious as to what is causing this problem though. I am trying to work backwards from this line from the error log
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\notMyUsername\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
I can call the first part of that command with
node
in Powershell. Once I'm in the node shell, how would I load the npm-cli and then run react-scripts?
Second, if I wanted to view verbose debugging output from a project where
npm start
launches the development server as desired, how would I go about doing that?
You're probably missing ./node_modules/.bin
in your path; normally the node installation will add this for you.
@dxmann73 You are correct that ./node_modules/.bin directory is not in my user or system path. However, as I mentioned, I have a second project in the same parent directory as the failing project that works as expected, and it's local bin is also _not_ in my path variable.
i ran into similar problem on windows 10 with cygwin...
if i change package.json and add a '.cmd' suffix to react-scripts references i no longer get the above error.
it looks like nodejs is confused about windows vs. cygwin vs. windows-bash... setting NODE_DEBUG=* indicates that PATH is being changed correctly internally but then windows cmd.exe is being used to run the command(react-scripts) but cannot find it...
further inspection of nodejs indicates questionable decision design for example node_modules/npm/lib/utils/is-windows-bash.js contains "process.env.TERM === 'cygwin'", which makes no sense as a way to detect cygwin, and is no longer valid for cygwin terminal emlation via mintty,
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
@mitchbassProbus I suspect you are correct as I have a similar stack on my machine (Windows 10 + Windows Bash + Cygwin) but I haven't explored the issue further. For development I have resorted to launching the react-scripts functionality from the local node_modules/.bin directory and haven't had any snags.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
I'm also having difficulties with this when running from a cmd console in windows 10. Since the default is going for "react-scripts start" or running "npm run start" (and that usually points to "react-scripts start"), this error is plainly confusing for new people.
I have run into this as well and my solution was to reinstall NVM for Windows I am using and let it (re)take control over the installed NPM version upon being asked to do so by the installer. This fixes all PATH issues.
Another option is to use the NodeJS command prompt recent versions of Node install. That saved me when nothing else worked.
I can't share this in #1627 as it is locked, so hopefully it will help someone here.
I am just using powershell (though I have WSL installed, I'm not using it for this), and used the following command to make it work, since yarn start
fails. This isn't ideal, but at least it works.:
> .\node_modules\.bin\react-scripts.cmd start
FWIW "npx react-scripts start" also worked for me at some point. This issue went away for me with a Windows update completely, but I settled on that while it was happening. Since react-scripts is already in node_modules, NPX will not download or install anything, it will just execute it.
Strange. Tried npx react-scripts start
this morning and it still downloaded it even though it's in the node_modules directory.
@rschuetzler
As a warning, I had some strange polyfill issues when trying to build the code for production via .node_modules.bin\react-scripts build
@ianHunterClipd
Try using npm i -g react-scripts
I was having the same error and was fixed might fix your problem too
I don't remember why and I'm on mobile so I can't look it up but either up thread or for sure on Stack Overflow the maintainers said you shouldn't install React Scripts globally. Like I said though I'm not sure why exactly was it.
I am also having this issue.
I'm using:
Node v10.16.0
npm 6.10.0
When I do npm ls react
, only this shows up:
└── [email protected]
I am just using powershell (though I have WSL installed, I'm not using it for this), and used the following command to make it work, since
yarn start
fails. This isn't ideal, but at least it works.:> .\node_modules\.bin\react-scripts.cmd start
I'm having the same issue and this worked for me. Any luck finding a fix for npm start?
npm ls
and then manually install all
npm ERR! missing: packages
it solved my problem
I am also having this issue. I installed a fresh build of create-react-app on my mac book, uploaded to source control, then cloned on my windows machine and tried
npm run build
I have linked the entire error log I am receiving in hopes this can help.
2019-07-19T01_52_13_342Z-debug.log]
UPDATE: I just solved it by deleting all of my node modules and then re-installing them.
if i change package.json and add a '.cmd' suffix to react-scripts references i no longer get the above error.
it looks like nodejs is confused about windows vs. cygwin vs. windows-bash... setting NODE_DEBUG=* indicates that PATH is being changed correctly internally but then windows cmd.exe is being used to run the command(react-scripts) but cannot find it...
This fix worked for me. I'm not using cygwin, however, I am using WSL.
@ianHunterClipd
Try usingnpm i -g react-scripts
I was having the same error and was fixed might fix your problem too
thanks a lot, it was really helpful on my project.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.
Most helpful comment
@ianHunterClipd
Try using
npm i -g react-scripts
I was having the same error and was fixed might fix your problem too