npm install
before npm start
and you鈥檒l be fine. See the explanation.I followed instructions when setting up sass but after did the last step I get error in the title
these are scripts in json package
"scripts": {
"build-css": "node-sass src/ -o src/",
"watch-css": "npm run build-css && node-sass src/ -o src/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
If it was normal it would start the server and it would compile sass files
In cli it should run script normally but I get error 'react-scripts' is not recognized as an internal or external command, operable program or batch file.'
'react-scripts' is not recognized as an internal or external command, operable program or batch file.
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven鈥檛 ejected): `--(empty)node -v
: v7.0.0npm -v
: v3.10.8Then, specify:
Does this variation work?
```js
"scripts": {
"build-css": "node-sass src/ -o src/",
"build-js": "react-scripts build",
"build": "npm run build-css && npm run build-js",
"start-css": "npm run build-css && npm run build-css -- --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p start-css start-js",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
(Update: edited suggestion above. Can you try the last version I posted?)
It doesn't work. I forgot to add this part of error
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v7.0.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm-run-all -p start-css start-js`
npm ERR! Exit status 1
Could it be that your node_modules
is corrupted?
Can you run npm install
and try again?
If it doesn't work please post the complete output again.
I tried it.... same error. This is entire output
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\OunknownO\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-js"
npm ERR! node v7.0.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start-js: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start-js script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the WeatherApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs WeatherApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls WeatherApp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\OunknownO\AppData\Roaming\npm-cache\_logs\2017-02-24T09_33_23_854Z-debug.log
ERROR: "start-js" exited with 1.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\OunknownO\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v7.0.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm-run-all -p start-css start-js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'npm-run-all -p start-css start-js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the WeatherApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm-run-all -p start-css start-js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs WeatherApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls WeatherApp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\OunknownO\AppData\Roaming\npm-cache\_logs\2017-02-24T09_33_24_779Z-debug.log
E:\PrivatniProjekti\WeatherApp>
> [email protected] build-css E:\PrivatniProjekti\WeatherApp
> node-sass src/ -o src/
No input file was found.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\OunknownO\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build-css"
npm ERR! node v7.0.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-css: `node-sass src/ -o src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-css script 'node-sass src/ -o src/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the WeatherApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-sass src/ -o src/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs WeatherApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls WeatherApp
npm ERR! There is likely additional logging output above.
@mysticatea Do you think you could shed any light on this? npm-run-all
works fine with the same commands on macOS, do you know if there are any issues on Windows?
Wait...
You're saying npm ls react-scripts
gives you no results? This definitely means your installation is botched somehow.
Can you show your full package.json
and a screenshot of react-scripts
in your node_modules
folder?
Did you do anything to your project folder at all? Like, move it somewhere, or copy and paste files.
nop, i didn't move it but I don't see react-scripts folder in node_modules.
Can you show me the full package.json
?
{
"name": "WeatherApp",
"version": "0.1.0",
"private": true,
"devDependencies": {
"autoprefixer": "6.5.1",
"babel-core": "6.17.0",
"babel-eslint": "7.1.1",
"babel-jest": "17.0.2",
"babel-loader": "6.2.7",
"babel-preset-react-app": "^2.0.1",
"case-sensitive-paths-webpack-plugin": "1.1.4",
"chalk": "1.1.3",
"connect-history-api-fallback": "1.3.0",
"cross-spawn": "4.0.2",
"css-loader": "0.26.0",
"detect-port": "1.0.1",
"dotenv": "2.0.0",
"eslint": "3.8.1",
"eslint-config-react-app": "^0.5.0",
"eslint-loader": "1.6.0",
"eslint-plugin-flowtype": "2.21.0",
"eslint-plugin-import": "2.0.1",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.4.1",
"extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0",
"filesize": "3.3.0",
"fs-extra": "0.30.0",
"gzip-size": "3.0.0",
"html-webpack-plugin": "2.24.0",
"http-proxy-middleware": "0.17.2",
"jest": "17.0.2",
"json-loader": "0.5.4",
"node-sass": "^4.5.0",
"npm-run-all": "^4.0.2",
"object-assign": "4.1.0",
"path-exists": "2.1.0",
"postcss-loader": "1.0.0",
"promise": "7.1.1",
"react-dev-utils": "^0.4.2",
"recursive-readdir": "2.1.0",
"strip-ansi": "3.0.1",
"style-loader": "0.13.1",
"url-loader": "0.5.7",
"webpack": "1.14.0",
"webpack-dev-server": "1.16.2",
"webpack-manifest-plugin": "1.1.0",
"whatwg-fetch": "1.0.0"
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-redux": "^5.0.2",
"redux": "^3.6.0",
"redux-logger": "^2.8.1",
"redux-promise-middleware": "^4.2.0",
"redux-thunk": "^2.2.0"
},
"scripts": {
"build-css": "node-sass src/ -o src/",
"watch-css": "npm run build-css && node-sass src/ -o src/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>\\config\\polyfills.js"
],
"testPathIgnorePatterns": [
"<rootDir>[/\\\\](build|docs|node_modules)[/\\\\]"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>\\config\\jest\\cssTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>\\config\\jest\\fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
}
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
I apologize for wasting your time, it seems that my colleague did "eject"
You didn't mention that you ejected. 馃槈
Right. So you'll need to replace react-scripts <something>
from the docs with node scripts/<something>.js
to match what your start
and build
scripts currently say.
I have same problem, but I still not know how to fix it
So you'll need to replace react-scripts
from the docs with node scripts/ .js to match what your start and build scripts currently say.
Please give me somecode, or exaclly how to fix ?
My package.js
{
"name": "MyApp",
"version": "0.1.0",
"private": true,
"devDependencies": {
"node-sass": "^4.5.0",
"npm-run-all": "^4.0.2",
"react-scripts": "0.9.0"
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"scripts": {
"build-css": "node-sass src/ -o src/",
"watch-css": "npm run build-css && node-sass src/ -o src/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
@NgKhanh
You have not "ejected" so the advice in this thread is not relevant to you. As we found out in https://github.com/facebookincubator/create-react-app/issues/1627#issuecomment-282290508, original poster has "ejected" which is why react-scripts
no longer existed for them.
In your case, however, it should exist. So if you have this problem, it might mean that npm didn't properly install the package. Can you verify node_modules/.bin/react-scripts
exists? If not, run rm -rf node_modules
and npm install
and then try again.
I am having the same issue here. I created a working app using create-react-app on a separate machine, and pushed to github. On this machine, I cloned the repo and attempted to run npm start
. I got the same error message about the react-scripts being unrecognized. I tried uninstalling, and reinstalling create-react-app globally. Any help would be appreciated. I'd like to be able to develop from multiple machines.. (I am also new to node so bear with me).
My very simple package.json:
{
"name": "thisisthename",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^3.3.7",
"create-react-app": "^1.3.0",
"google-map-react": "^0.24.0",
"google-maps-react": "^1.0.19",
"react": "^15.5.4",
"react-bootstrap": "^0.30.8",
"react-dom": "^15.5.4"
},
"devDependencies": {
"react-scripts": "0.9.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
On this machine, I cloned the repo and attempted to run npm start.
It is not enough to run npm start
. You need to run npm install
to get the dependencies to your machine first. This is not unique to Create React App鈥攊t鈥檚 just how JS apps generally work in Node/npm ecosystem.
package.json
specifies the dependencies but doesn鈥檛 actually include the source code for them (sometimes they鈥檙e pretty large). So you need to run npm install
in the project folder after cloning. After that, other commands will work too.
Also, make sure that NODE_ENV is not set to a production on a development machine. I was using react-scripts-ts in the package.json devDependencies and NODE_ENV was somehow in the production mode and therefore npm/yarn didn't install react-scripts-ts.
"devDependencies": {
"react-scripts-ts": "1.4.0"
},
This is interesting. Maybe we should just move them to dependencies
.
@gaearon I am not 100% if that is a good way to solve the issue as the original fault was mine. I left the NODE_ENV to a wrong state.
On the actual production environment, it would load extraneous packages?
I guess, my original reason was to try running production mode on some other project and forgot to change back to the development.
These days I run my npm scripts like this to just to be sure:
NODE_ENV=development yarn start
That command works at least on my cygwin bash on Windows machine.
On the actual production environment, it would load extraneous packages?
That's not how it works. In practice, for CRA "production environment" doesn't make sense because your build output is HTML/JS/CSS and not a Node app.
@gaearon I am getting similar error: I haven't eject
ed and having:
$ node -v
v7.10.0
$ npm -v
4.2.0
And
$ npm ls react-scripts
[email protected] /home/<dir>/app
`-- [email protected]
and there is node_modules/.bin/react-scripts
exists
Having this error message:
Starting the development server...
events.js:163
throw er; // Unhandled 'error' event
^
Error: watch /home/affine/Development/MSM-Visualization/app/public ENOSPC
at exports._errnoException (util.js:1050:11)
at FSWatcher.start (fs.js:1398:19)
at Object.fs.watch (fs.js:1424:11)
at createFsWatchInstance (/home/affine/Development/MSM-Visualization/app/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/affine/Development/MSM-Visualization/app/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/affine/Development/MSM-Visualization/app/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/affine/Development/MSM-Visualization/app/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/affine/Development/MSM-Visualization/app/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/affine/Development/MSM-Visualization/app/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:114:15)
npm ERR! Linux 4.4.0-78-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/affine/.npm/_logs/2017-05-31T11_56_34_465Z-debug.log
Tried npm install
and it completed without any errors. Any idea?
I started afresh.
Installed create-react-app again.
$create-react-app --version
1.3.1
After
create-react-app my-app
cd my-app
yarn start
gave below error. (I didn't run npm install now. Though there is node_modules/ with node_modules/.bin/react-scripts
it):
````
Starting the development server...
events.js:163
throw er; // Unhandled 'error' event
....
at FSReqWrap.oncomplete (fs.js:114:15)
error Command failed with exit code 1.
````
Ran npm install
again. But no improvement. Same errors for both npm
and yarn
.
EDIT: Tried with an old package.json from your comment https://github.com/facebookincubator/create-react-app/issues/1363#issuecomment-271286337. It'sworking now. Not sure about the current issue though.
The error message says:
Error: watch /home/affine/Development/MSM-Visualization/app/public ENOSPC
"ENOSPC" means "no space". Your disk ran out of space and it is causing issues.
Er.. I have around 98GB of free space. And using an old package.json
got it working.
I still have this error. I do "npm install". After this command, it gets solved for a while. After an hour or so, I get this again.
Most helpful comment
Could it be that your
node_modules
is corrupted?Can you run
npm install
and try again?If it doesn't work please post the complete output again.