Closed instacode-AU closed 7 years ago
Please review this list: https://github.com/coryhouse/javascript-development-environment#having-issues-try-these-things-first
Also, I'm unclear what command you're running.
Does the final course exercise posted on the course page under "exercise files" work for you? (check the final module folder)
The issue is with .babelrc When I changed it to babel-recommended
{"presets": [
["env", {
"targets": {
"node": "current"}
}]
]
}
it worked just fine.
@magdalenagorecka If that worked for you, then you're running babel-preset-env instead. Yes, that also works, and is the new standard, but in the course I used babel-preset-latest.
The issue is when i run "npm start", looks like the issue is with the babel node references. I have downloaded the final version and that works fine, I'll run a comparison between the files and report back on my findings. Thanks for your assistance @coryhouse and @magdalenagorecka
While I ran into the same problem, my solution was actually using the vscode auto repair for the ES6 module declaration, we had
var chalk = require('chalk');
@coryhouse suggested we used:
var chalk = require('chalk');
That didn't work out so I used the vscode suggestion:
import { green } from 'chalk';
And that worket out just fine, (we we're using console.log(green()) just below).
Can someone explain to me why can't I just import just chalk?
@yagomassiah - As shown in the chalk docs, If you import chalk as
import chalk from chalk;
Then you must consume it as
chalk.green('green message here')
Hello cory, I am facing the following error. Can you please help me out for the same?
internal/modules/cjs/loader.js:583 throw err; ^
Error: Cannot find module '/Users/kaustubhpatkar/WebstormProjects/MyReactApp/tools/startMessage.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at Object.
Can you please post on the course discussion instead? That said, it looks like the path to startMessage is incorrect.
The issue is with .babelrc When I changed it to babel-recommended
{"presets": [ ["env", { "targets": { "node": "current"} }] ] }
it worked just fine.
This worked for me though I had to replace "env"
with "@babel/env"
When i run the babel-node enabled package.json file I receive an error. Output from npm-debug.log below:
0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] 2 info using npm@3.10.10 3 info using node@v6.11.3 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle javascript-development-environment@1.0.0~prestart: javascript-development-environment@1.0.0 6 verbose lifecycle javascript-development-environment@1.0.0~prestart: unsafe-perm in lifecycle true 7 verbose lifecycle javascript-development-environment@1.0.0~prestart: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/[username]/Documents/MIM Practice/js-dev-env/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 8 verbose lifecycle javascript-development-environment@1.0.0~prestart: CWD: /Users/[username]/Documents/MIM Practice/js-dev-env 9 silly lifecycle javascript-development-environment@1.0.0~prestart: Args: [ '-c', 'babel-node buildScripts/startMessage.js' ] 10 silly lifecycle javascript-development-environment@1.0.0~prestart: Returned: code: 1 signal: null 11 info lifecycle javascript-development-environment@1.0.0~prestart: Failed to exec prestart script 12 verbose stack Error: javascript-development-environment@1.0.0 prestart:
babel-node buildScripts/startMessage.js12 verbose stack Exit status 1 12 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) 12 verbose stack at emitTwo (events.js:106:13) 12 verbose stack at EventEmitter.emit (events.js:191:7) 12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14) 12 verbose stack at emitTwo (events.js:106:13) 12 verbose stack at ChildProcess.emit (events.js:191:7) 12 verbose stack at maybeClose (internal/child_process.js:920:16) 12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5) 13 verbose pkgid javascript-development-environment@1.0.0 14 verbose cwd /Users/[username]/Documents/MIM Practice/js-dev-env 15 error Darwin 17.0.0 16 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 17 error node v6.11.3 18 error npm v3.10.10 19 error code ELIFECYCLE 20 error javascript-development-environment@1.0.0 prestart:
babel-node buildScripts/startMessage.js20 error Exit status 1 21 error Failed at the javascript-development-environment@1.0.0 prestart script 'babel-node buildScripts/startMessage.js'. 21 error Make sure you have the latest version of node.js and npm installed. 21 error If you do, this is most likely a problem with the javascript-development-environment package, 21 error not with npm itself. 21 error Tell the author that this fails on your system: 21 error babel-node buildScripts/startMessage.js 21 error You can get information on how to open an issue for this project with: 21 error npm bugs javascript-development-environment 21 error Or if that isn't available, you can get their info via: 21 error npm owner ls javascript-development-environment 21 error There is likely additional logging output above. 22 verbose exit [ 1, true ]