While starting my application, I get this error. I have already checked and seen that the required module is well installed, and also gave it global access.
Hussains-MacBook-Pro:NodeRest-Shop Hussain$ npm start
> noderest-shop#1.0.0 start /Users/Hussain/Desktop/Development/Web/NodeRest-Shop
> nodemon server.js
module.js:549
throw err;
^
Error: Cannot find module 'binary-extensions'
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> (/Users/Hussain/Desktop/Development/Web/NodeRest-Shop/node_modules/is-binary-path/inde
x.js:3:24)
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! noderest-shop#1.0.0 start: `nodemon server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the noderest-shop#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! /Users/Hussain/.npm/_logs/2018-06-25T05_23_59_594Z-debug.log
You're missing the binary-extensions module, as seen in your log:
Error: Cannot find module 'binary-extensions'
It could be that you're missing some dependencies or forgot to include it.
You can install it using npm:
npm install binary-extensions
And include binaryExtensions in your project:
const binaryExtensions = require('binary-extensions');
I fixed this issue by running:
npm i npm#latest -g
Check your app.js file your index route should be
app.use(require('./routes/')); not app.use(require('./routes/index'));
Related
I'm trying to set up a project using webpack. When I try to serve it using webpack I get this:
root#d690f9010746:~/chat-webapp# npm run serve
> chat-webapp#1.0.0 serve /root/chat-webapp
> webpack serve --config webpack.config.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '../../lib/webpack-cli'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/root/chat-webapp/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/root/chat-webapp/node_modules/#webpack-cli/serve/index.js:4:20)
at Module._compile (/root/chat-webapp/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chat-webapp#1.0.0 serve: `webpack serve --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chat-webapp#1.0.0 serve 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! /root/.npm/_logs/2020-05-31T19_42_42_752Z-debug.log
The line /root/chat-webapp/node_modules/#webpack-cli/serve/index.js:4 (mentioned in the stacktrace) says: const WebpackCLI = require("../../lib/webpack-cli");. But I don't have the file /root/chat-webapp/node_modules/lib/webpack-cli - and even if I did, it's not in the #webpack-cli/serve repo, and the repo shouldn't be making assumptions about the locations of files it doesn't control.
And yet I can't find anyone or stackoverflow or anywhere else who's getting an error on the same relative path. So what am I missing? I've installed all the npm repos locally, which is a bit non-standard - could it be something to do with that?
I recently created an api called jkanime using Typescript. I have the problem after publishing it on the npm platform, it shows me an error when using the API functions.
The error comes from the imports of some packages that I use to create the jkanime API.
Here I leave the api repository, if someone wants to help me how to correctly upload the package to the npm platform. https://github.com/ChrisMichaelPerezSantiago/jkanime
var jkanime = require("jkanime");
jkanime.lastAnimesAdded()
.then(doc => console.log(doc));
Error
import * as cheerio from 'cheerio';
^
SyntaxError: Unexpected token *
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\c\Desktop\jkanime\test\index.js:1:13)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test#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\c\AppData\Roaming\npm-cache\_logs\2019-08-16T01_07_55_949Z-debug.log
RunKit Link: https://npm.runkit.com/jkanime
You probably did not build your library before publishing also in package.json I see your main file is set to index.js and its nowhere to be seen?
I would advise you to use something like typescript-library-starter for creating typescript libraries at least check it to see what you need to create a library project with typescript.
I have a NodeJs Application and I try to start it in terminal using npm run start:prod. I receive the error:
Error: Cannot find module '../dist'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous>
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
npm ERR! errno 1
npm ERR! mern-starter#2.0.0 start:prod: `cross-env NODE_ENV=production node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mern-starter#2.0.0 start:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
And there is indeed no dist folder or file. What is it usually used for?
Do you know how it can be solved?
I'm getting 'Error: Cannot find module '../scripts/start' from projects set up using create-react-app that previously worked fine, now when i run 'npm start' i'm getting this error - the only workaround seems to be rm -rf node_modules followed by npm install, but next day I run into the same problem. Any ideas how to fix this please (see full error message below) - thanks.
>react-scripts start
module.js:549
throw err;
^
Error: Cannot find module '../scripts/start'
at Function.Module._resolveFilename (module.js:547:15)
at Function.resolve (internal/module.js:18:19)
at Object.<anonymous> (/Users/DANTHORY/Dropbox/card-slider-challenge_TESTING/node_modules/.bin/react-scripts:28:25)
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)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! card-slider-challenge#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the card-slider-challenge#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
package.json:
{
"name":"card-slider-challenge",
"version":"0.1.0",
"private":true,
"scripts":{
"start":"react-scripts start",
"build":"react-scripts build",
"test":"jest",
"eject":"react-scripts eject",
"start-api":"json-server --port 3001 --watch --static none data/db.json"
},
"dependencies":{
"react":"^16.3.2",
"react-dom":"^16.3.2",
"react-slick":"^0.23.2"
},
"devDependencies":{
"jest":"^24.0.0",
"json-server":"^0.12.2",
"react-scripts":"^1.1.4"
}
}
I had the exact same issue and I did the following:
Delete node_modules folder
Run npm install
It fixed my issue, but what it caused, I don't know.
I changed my computer and I clone my projet from Github
Delete node_modules folder
Run npm install
I am trying to 'eb deploy' a node.js with javascript sdk addition.
It works fine locally but every time I have tried to - eb deploy- it I get this in the logs
npm ERR! npm bugs node-express
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls node-express
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
> node-express#0.0.0 start /var/app/current
> node main.js
{ [Error: ENOENT: no such file or directory, open '.env'] errno: -2, code: 'ENOENT', syscall: 'open', path: '.env' }
module.js:327
throw err;
^
Error: Cannot find module 'parse/node'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/app/current/api/common/parse.js:3:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
...npm ERR! code ELIFECYCLE
npm ERR! node-express#0.0.0 start: `node main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-express#0.0.0 start script 'node main.js'.
npm ERR! This is most likely a problem with the node-express package,
I have repeatedly tried
npm install express --save
and yes I have also run npm install parse (it all works fine locally).
To no avail. Why would it all work like a charm locally but not on AWS EB ?
-Thanks for any clues.
Not sure if this will help someone. Ultimately I solved this by
'npm install moduleName --save' on all of my modules. One by one.
Still not sure why the site worked locally ?
-best of luck.