Open imsam67 opened 8 years ago
Have you run npm install? What version of node and npm are your running? What OS?
Yes, I have run npm install
I'm running node version 6.3.1 and npm 3.10.9. I'm running this on a Windows 10 machine build 14393.321
I got all this information using the built-in terminal in Visual Studio Code from inside the project folder -- except Windows 10 build.
Also if I run npm list babel-node
from the terminal, I get (empty) so it doesn't seem to be installed. By the way, babel-node is not in package.json either.
Like you, npm list babel-node returns nothing for me, but it works because it's bundled with babel.
If you look in node_modules/.bin, you should see a babel-node folder. Do you?
Same problem for me with Windows 10... No babel-node is installed. Nothing under .bin.
There is no babel-node folder inside "node_modules" or "node_modules/.bin"
I'm attaching a screen shot of the .bin folder under node_modules
Ditto for me. No babel-node in the bin directory. I sort of got it to work by installing babel-cli globally but now it doesn't recognize anything in the package.json, so that's not a fix.
That's bizarre. I've just tried it in the terminal in the latest version of Visual Studio Code and on the native terminal in Windows 10. It works just fine in both.
Are you all using the project completely unchanged? I simply cloned this repo on Windows 10 and it worked. I'm using Node 6.3 as well.
I didn't clone the project. I'm creating the files/folders as I go through the PluralSight video. The only difference is that instead of using WebStorm, I'm using Visual Studio Code.
node v6.5, npm v3.10.3, Atom... Windows 10. I just deleted and recloned the directory, npm installed, npm started, same deal.
I downgraded node to 5.14 and it works! Thanks. That was actually in the readme. Windows has a problem with Node 6.
Good to hear you're rolling Paul. The frustrating thing is Node 6 works fine on some Windows machines. I'd like to figure out why some Windows machines are failing, but I haven't been able to reproduce on any of my Windows boxes.
@imsam67 Have you tried running Node 5 instead? That has resolved the issue for some others on Windows.
It didn't work for me. See the image below
I don't know how Paul was able to go down to 5.14. I don't see that version even listed here: https://nodejs.org/en/download/releases/
Interestingly, if I download the whole project from GitHub and run npm install
, I do end up with babel-node in .bin and npm start -s
works fine
Not sure why when I was simply following the video and created things step by step, it didn't work. Possibly skipping something unintentionally
Interesting. I recommend avoiding paths with a space. Also, if downloading this project from github works fine, then I'd be interested to know what's different with your hand built version. Did you perform a diff? Alternatively, can you post it on Github?
Sorry about the late response. I tried to figure out what's causing the issue but couldn't. Here's the repo for what I have in my project folder. https://github.com/imsam67/reactredux
@imsam67 I just cloned your project and it fails on npm start because you haven't created testSetup.js, which is being called by the start script.
Cory, thanks for trying to figure this out. You're right that I had not created the testSetup.js file. Though I just added it, still getting the same error.
For some reason, the babel-node is not being installed. I even copied and pasted both package.json and webpack.config.dev.js directly from the repo but still getting the same error.
Very strange. I can't reproduce. Can you show me what's in your node_modules?
Try the following: npm install -g babel-cli
@imsam67 - Can you show me what's in your node_modules folder? A screenshot of the folders that fit on screen would suffice.
Here's what fits on screen
That screenshot looks good. And if you see babel-node in node_modules/.bin then you should be working fine now.
I am not sure if you have the same issue but I was getting the same problem until I realised I had saved my .babelrc file under src instead of the project root at the same level as package.json. I must have had src as the active folder when I saved.
As a side note, I used Intellij a lot in the past but now I have been using Atom before where it is more obvious where you are saving I find Webstorm a little clunky in file manipulation and editing compared to Atom/Sublime et. al. @coryhouse do you have any suggestions on how to make Webstorm more like Atom or Sublime for editing?
Oh and as another tip, you can see if babel-node is working but adding another script in your package.json
"scripts": {
"start": "babel-node tools/srcServer.js",
"babel-node-version": "babel-node --version"
},
then run
npm run babel-node-version
then see the version 6.8.0
Hi all, same issue, windows 10, following on pluralsight and just setting up the project. I have managed to resolve but i did this by reinstalling every version of babel i could.. babel-cli, babel-node etc and eventually it worked..
One other thing to try for anyone who gets bit by this: Delete node_modules and reinstall.
@coryhouse I tried to delete node_modules like you said. No change.
'babel-node' is not recognized as an internal or external command, operable program or batch file.
Do you have any other ideas? I copied srcServer.js, package.json, webpack.config.dev.js and .babelrc directly from the github.
@xenoxsis - Have you checked this list? https://github.com/coryhouse/pluralsight-redux-starter#having-issues-try-these-things-first
same for me. Running npm start -s I get: 'npm-run-all' is not recognized as an internal or external command, I don't have babel-node in the node_modules/.bin folder.
It sounds like you didn't run npm install. npm-run-all is in the package.json.
thanks for getting back to me. I def did run npm install. To be sure, I rebooted, deleted node_modules and just ran it again. The results do seem a little sparce:
+-- object-assign@4.1.0
+-- react@15.4.1
| +-- fbjs@0.8.9
| | +-- core-js@1.2.7
| | +-- isomorphic-fetch@2.2.1
| | | +-- node-fetch@1.6.3
| | | | +-- encoding@0.1.12
| | | | | -- iconv-lite@0.4.15 | | | |
-- is-stream@1.1.0
| | | -- whatwg-fetch@2.0.3 | | +-- promise@7.1.1 | | |
-- asap@2.0.5
| | +-- setimmediate@1.0.5
| | -- ua-parser-js@0.7.12 |
-- loose-envify@1.3.1
| -- js-tokens@3.0.1 +-- react-dom@15.4.1 +-- react-redux@5.0.1 | +-- hoist-non-react-statics@1.2.0 | +-- invariant@2.2.2 | +-- lodash@4.17.4 |
-- lodash-es@4.17.4
+-- react-router@3.0.0
| +-- history@3.3.0
| | -- query-string@4.3.2 | |
-- strict-uri-encode@1.1.0
| -- warning@3.0.0 +-- react-router-redux@4.0.7 +-- redux@3.6.0 |
-- symbol-observable@1.0.4
`-- redux-thunk@2.1.0
I guess it must be some failure of npm install, because if I run npm run setup, it complains that it doesn't hjave rifraf. And then I do npm install riraf and again try npm run setup and it complains about chalk, etc etc. So, eventually, I run: npm install npm-run-all. Same for babel-node. I think I'm done. Then I try: npm start -s and get this: C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:328 throw e; ^
Error: Couldn't find preset "stage-1" relative to directory "E:\VisualStudio\Projects\react\react-slingshot-master" at C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19 at Array.map (native) at OptionManager.resolvePresets (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20) at OptionManager.mergePresets (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10) at OptionManager.mergeOptions (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14) at OptionManager.init (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12) at compile (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:103:45) at loader (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:144:14) at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:154:7) at Module.load (module.js:488:32)
Will google it and see what's up.
Ah, got it! Just kept installing everything manually that it told me I was missing (ie. npm install something) So now npm start -s tries and fails for other reasons:
C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\logger.js:41 throw new Constructor(this._buildMessage(msg)); ^
ReferenceError: [BABEL] E:\VisualStudio\Projects\react\react-slingshot-master\tools\startMessage.js: Unknown option: base.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
Invalid:
{ presets: [{option: value}] }
Valid:
{ presets: [['presetName', {option: value}]] }
For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. at Logger.error (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\logger.js:41:11) at OptionManager.mergeOptions (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:226:20) at OptionManager.init (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12) at File.initOptions (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\index.js:216:65) at new File (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\file\index.js:139:24) at Pipeline.transform (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\transformation\pipeline.js:46:16) at Object.transformFileSync (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-core\lib\api\node.js:152:10) at compile (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:118:20) at loader (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:144:14) at Object.require.extensions.(anonymous function) [as .js] (C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:154:7)
I moved over from Atom to VS Code and all is well...
@JohnnyKNL It sounds like you were running commands outside of the project root. It's important to run npm install and npm start in the same directory as package.json. You shouldn't have had to type npm install for each dependency. That's what package.json is for - when you type npm install, it'll install all the dependencies listed in package.json.
I'm also on Windows 10 64-bit, however running node 7.5.0
with npm 4.1.2
.
I've removed node_modules and ran npm install
and still there isn't the babel-node
folder either.
C:\var\www\project>npm list babel-node
project@0.0.1 C:\var\www\project
`-- (empty)
@jamiehutber Does the final course exercise available under the course exercises tab run for you?
Someone else mentioned this, but I'll repeat it... Using Visual Studio Code seems to fix a lot of issues I've had with NPM/Webpack on Windows, fyi - across all my NPM-driven projects. I was a big Atom user, but something was always going wrong that wouldn't happen on my Mac.
On Mon, Mar 20, 2017 at 2:32 AM, deepakbaghel notifications@github.com wrote:
For resolving this on Windows 10...
1# Hit 'Windows button' and go to home screen 2# Type 'cmd' in search 3# Right click on the 'command prompt' and select 'run as administrator' 4# Navigate to the project root in terminal, and run npm install as usual 5# Enjoy
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/coryhouse/pluralsight-redux-starter/issues/30#issuecomment-287692047, or mute the thread https://github.com/notifications/unsubscribe-auth/ARbP5a6Yi5KOXcv1GEgGd9tRnP0nqfSiks5rniuEgaJpZM4KeUml .
-- Paul Day Phone: 240-675-0683
I had the same babel-node not recognized as internal or external command
issue,
I'm using Atom on windows 10, with node v7.4.0
I was using a terminal plugin inside Atom,
I tried running npm install
from an admin Command Prompt and it downloaded the missing .bin files, now everything works like a charm
Thanks @mohamed-ismat! I've added this tip to the readme.
Ensure you do not have NODE_ENV=production in your env variables as it will not install the devDependencies.
Hi @coryhouse first thanks for the courses. it is great help in learning. :)
I also had the same problem and found out the the "latest" is deprecated in favor for "env". I did the following and it seems to work. Hope this helps. I also moved the .babelrc file to the root instead of the src folder
I had the same problem and I made it work in Atom by adding "babel-node": "6.5.3"
to devDependencies. I'm not sure whether this is the right way to go, but at least I won't have to switch to Visual Studio anytime soon (hopefully).
@coryhouse thanks for making the code available online, it saves a lot of time :D
Hi @coryhouse, I have babel-node
and babel-node.cmd
within node_modules/.bin
. Unfortunately calling babel-node --version
from the root of the project returns 'babel-node' is not recognized as an internal or..
. whereas calling the same command from node_modules/.bin
returns 6.18.0
. Any Idea what I can do?
@Bubblesphere you can't run the command from the project root unless you install it globally (npm install -g babel-cli) or add a script to your package.json to perform the task you need. Also, you should not use babel-node in production. https://babeljs.io/docs/usage/cli/
"scripts": {
"babel-node": "babel-node example.js"
}
npm run babel-node
Hi! For everyone having a problem with running babel. I have encountered the same problem on windows 10 with node 6 and Atom with built-in terminal.
I found out that the problem was that npm install
did not install devDependecies because for some reason windows set NODE_ENV to production.
EDIT: Actually I think the problem lies in atom and terminal package. In windows cmd (outside of atom) NODE_ENV is undefinied but in atom terminal is set to production.
One way around it is just to run npm install
and then npm install --only=dev
.
Or if you are just like me and like when everything run as expected try this.
First in cmd run: SET NODE_ENV=development
or if you have windows PowerShell: $env:NODE_ENV="development"
Sad thing is that you have to run it every time you open new terminal. I don't know yet how to change it globally.
Also you can check what is NODE_ENV simply create file test.js and add console.log(process.env.NODE_ENV);
then in your cmd run: node test.js
Hope this helps!
You must also make sure that you are using v8.1.2 instead of v6.11 version of nodejs. Also I believe you must also install npm-run-all globally. Possibly the same with babel-node.
As per BaReinhard above, I also had to upgrade nodejs 7.x.x to 8.1.2 (which upgraded npm to 5.4.0 too) and that fixed the problem for me. I had assumed that since I was on node > 6 I wouldn't have a problem, but it turned out that was an incorrect assumption. Wasted a good couple of hours trying to sort that out which is frustrating as the course is very good so far!
Hi @spettifer - Sorry to hear that - What issue were you seeing before you upgraded Node?
Hi @coryhouse, thanks for the reply!
It was very odd. The output of npm start was this:
C:_git\React\react-redux-intro>npm start pluralsight-redux-starter@1.0.0 start C:_git\React\react-redux-intro babel-node tools/srcServer.js
C:_git\React\react-redux-intro\node_modules\webpack-dev-middleware\middleware.js:106 if(err) throw err; ^ Error at pathToArray (C:_git\React\react-redux-intro\node_modules\memory-fs\lib\MemoryFileSystem.js:44:10) at MemoryFileSystem.mkdirpSync (C:_git\React\react-redux-intro\node_modules\memory-fs\lib\MemoryFileSystem.js:139:13) at MemoryFileSystem.(anonymous function) [as mkdirp] (C:_git\React\react-redux-intro\node_modules\memory-fs\lib\MemoryFileSystem.js:279:34) at Compiler.
(C:_git\React\react-redux-intro\node_modules\webpack\lib\Compiler.js:229:25) at Compiler.applyPluginsAsync (C:_git\React\react-redux-intro\node_modules\tapable\lib\Tapable.js:60:69) at Compiler.emitAssets (C:_git\React\react-redux-intro\node_modules\webpack\lib\Compiler.js:226:7) at Watching. (C:_git\React\react-redux-intro\node_modules\webpack\lib\Compiler.js:54:18) at C:_git\React\react-redux-intro\node_modules\webpack\lib\Compiler.js:403:12 at Compiler.next (C:_git\React\react-redux-intro\node_modules\tapable\lib\Tapable.js:67:11) at Compiler. (C:_git\React\react-redux-intro\node_modules\webpack\lib\CachePlugin.js:40:4) npm ERR! Windows_NT 10.0.10240 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program > Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" npm ERR! node v7.0.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! pluralsight-redux-starter@1.0.0 start:
babel-node tools/srcServer.js
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pluralsight-redux-starter@1.0.0 start script 'babel-node tools/srcServer.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 pluralsight-redux-starter package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! babel-node tools/srcServer.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs pluralsight-redux-starter npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls pluralsight-redux-starter npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! C:_git\React\react-redux-intro\npm-debug.log`
And the npm-debug.log file didn't really add any more info than that. I tried messing about with babel-node, I deleted node_modules and did a cache clean and reinstall all to no avail. I also tried with verbose output from npm start, but that didn't reveal much either (at least not to me - maybe someone with more experience would see something I can't).
It was sheer desperation that made me try upgrading from node 7 to node 8 (which brings npm 5.4.0 with it) and suddenly it burst into life. I have no idea why. The most curious thing was that if I cloned your repo it worked perfectly well, even with the scripts section pared down to just the start script (which is where I was in the course). I can only assume it was some quick of npm but quite why it worked on the cloned repo but not the project I was building up from scratch is a mystery.
I'm following along the tutorial on PluralSight for React with ES6 and Redux. I'm using Visual Studio Code as my editoe. When I add
babel-node
in the start script, I getAny idea why?