when i enter npm start in the cmd i got that error:
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\fmanagement\db_mysql\dbconnection.js:1:75)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fmanagement#1.0.0 start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fmanagement#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Flavio Luiz\AppData\Roaming\npm-cache_logs\2018-08-16T23_51_52_867Z-debug.log
after that im install mysql with
npm install -g mysql
and that is my dbconnection.js:
var mysql = require('mysql');
var connection=mysql.createPool({
host:'jdbc:mysql://localhost:3306/',
user:'root',
password:'',
database:'fmanagement'
});
module.exports=connection;
im newbie with node js. im doing something wrong?
Related
So I am following an online course and I am stuck. I am running the command npm run start in cmd and it seems not to be working.
Here is the webpack.config.js file:
enter image description here
Here is the package.json file:
enter image description here
Here is the error code I get from cmd:
C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter>npm run start
> forkify#1.0.0 start C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter
> webpack-dev-server --mode development --open
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\user\\Desktop\\complete-javascript-course-master\\9-forkify\\starter\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! forkify#1.0.0 start: `webpack-dev-server --mode development --open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the forkify#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-05-04T10_43_57_046Z-debug.log
C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter>
What could be possibly wrong please?
I am trying to upgrade to Polymer 3 from Polymer 2. My environment follows:
Debian Stretch
npm version 6.1.0
command run with root account: npm install -g polymer-cli
Any idea? Thank you in advance!
/usr/bin/polymer -> /usr/lib/node_modules/polymer-cli/bin/polymer.js
> wd#1.6.2 install /usr/lib/node_modules/polymer-cli/node_modules/wd
> node scripts/build-browser-scripts
/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/polymer-cli/node_modules/wd/build'
at Object.fs.mkdirSync (fs.js:902:18)
at sync (/usr/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
at Object.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.3 (node_modules/polymer-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
This seems to be caused by npm issue #17346.
The current workaround is to call npm install -g polymer-cli with the --unsafe-perm flag until a new fix is released.
I want to install/use the Gulp-Plugin uncss (https://www.npmjs.com/package/gulp-un-css/) as my very first gulp-"try".
I therefore installed npm and Gulp successfully globally with the CLI version 3.9.1. I also installed the uncss-plugin with npm install gulp-uncss --save-dev and with sudo npm install gulp-uncss --save-dev.
At the end of that, I get the same message within the terminal:
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/me/project/front/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/phantomjs-prebuilt/node_modules/request/node_modules/hawk/lib/index.js:5:33)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
npm ERR! phantomjs-prebuilt#2.1.16 install: `node install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt#2.1.16 install script.
npm ERR! This is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 15.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "gulp-uncss" "--save-dev"
npm ERR! cwd /Users/me/project
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! code ELIFECYCLE
npm ERR! Error: ENOENT, lstat '/Users/me/project/node_modules/gulp-uncss/node_modules/uncss/node_modules/request/node_modules/form-data/node_modules/async/node_modules/lodash/throttle.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 15.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "gulp-uncss" "--save-dev"
npm ERR! cwd /Users/me/project
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path /Users/me/project/node_modules/gulp-uncss/node_modules/uncss/node_modules/request/node_modules/form-data/node_modules/async/node_modules/lodash/throttle.js
npm ERR! fstream_path /Users/me/project/node_modules/gulp-uncss/node_modules/uncss/node_modules/request/node_modules/form-data/node_modules/async/node_modules/lodash/throttle.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/me/project/npm-debug.log
npm ERR! not ok code 0
What/How can I solve that?
I installed gulp on my machine, but when i try to compile my project i have this error:
Error: Cannot find module 'del'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Applications/MAMP/htdocs/project/gulpfile.js:6:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I dont understand the error and i dont know how solve.
Someone can help me?
Thanks
This error message indicates that the module 'del' cannot be found. It seems that the 'del' package is not installed or not properly configured in your project.
Try installing the 'del' package by running the following command in your terminal:
npm install del --save-dev
If you have already installed 'del' package and still getting this error, try uninstalling and then reinstalling it.
npm uninstall del
npm install del --save-dev
Also make sure that you have the latest version of npm and node installed on your machine.
npm install -g npm
After installing or reinstalling 'del' package, you can try running the gulp command again and see if the error persists.
I am working with Node.js, Express.js and sqlite3 to create a small website.
I have developed my project in Ubuntu and I have been trying to get it to work in Mac also.
But after I svn checkout from my repository the folder of the project, and try to run my app.js file I get the following error:
module.js:356
Module._extensions[extension](this, filename);
^
Error: dlopen(/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/build/Release/node_sqlite3.node, 1): no suitable image found. Did find:
/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/build/Release/node_sqlite3.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/lib/sqlite3.js:1:104)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
The website works fine on Ubuntu. And also, the Mac computer has Node.js, sqlite3. Any help of why this is happening would be appreciated.
I removed the node_modules from my svn repository, and svn checkout my project folder into a mac computer. When I do npm install sqlite3 I get the following errors:
$ npm install sqlite3
npm WARN package.json application-name#0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/sqlite3
npm http 304 https://registry.npmjs.org/sqlite3
sqlite3#2.1.7 install /Users/cs205g1s13/BS/playing/node_modules/sqlite3
node-gyp rebuild
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp", line 15, in <module>
import gyp
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
import gyp.input
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 15, in <module>
import multiprocessing
ImportError: No module named multiprocessing
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:415:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node- gyp.js" "rebuild"
gyp ERR! cwd /Users/cs205g1s13/BS/playing/node_modules/sqlite3
gyp ERR! node -v v0.10.4
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! sqlite3#2.1.7 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the sqlite3#2.1.7 install script.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "sqlite3"
npm ERR! cwd /Users/cs205g1s13/BS/playing
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/cs205g1s13/BS/playing/npm-debug.log
npm ERR! not ok code 0
Did you check in your node_modules folder into svn? Don't do that. To fix it, run npm rebuild on your Ubuntu box. sqlite uses extensions that must be compiled on the host platform.