NPM start 'cannot find module' - node.js

When I try the command npm start the console runs npm install and returns this error:
> npm#6.4.1 prepare C:\Users\Aristophanes
> node bin/npm-cli.js --no-audit --no-timing prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'C:\Users\Aristophanes\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! npm#6.4.1 prepare: `node bin/npm-cli.js --no-audit --no-timing prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the npm#6.4.1 prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Full log: https://www.dropbox.com/s/de0369plkz8w2ir/2018-11-10T07_56_03_314Z-debug.log?dl=0
Can anyone explain the Cannot find module 'C:\Users\Aristophanes\bin\npm-cli.js' error? In the directory C:\Users\Aristophanes\bin\ I only have these files:
create-react-native-app
create-react-native-app.cmd
The npm-cli.js file it's looking for is actually located in C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
Does anyone have a suggestion to fix this? Thanks.

Related

framework7 stuck at executing npm scripts and start npm throws a bunch of errors

i am new to the framework and was just going through a tutorial and encountered by an error after pressing create app in the local host
Generating package.json
✔ Creating required folders structure
✔ Installing NPM Dependencies
✔ Installing NPM Dev Dependencies
Executing NPM Scripts
this happens its stuck at executing NPM scripts waited a whole 3 hours still executing
The start npm command shows the following:-
> whatchat#1.0.0 start C:\Users\piyush\whatchat
> npm run dev
> whatchat#1.0.0 dev C:\Users\piyush\whatchat
> cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'C:\Users\piyush\whatchat\build\webpack.config.js'
Require stack:
- C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js
- C:\Users\piyush\whatchat\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at WEBPACK_OPTIONS (C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
at requireConfig (C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
at C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (C:\Users\piyush\whatchat\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
at Object.<anonymous> (C:\Users\piyush\whatchat\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\piyush\\whatchat\\node_modules\\webpack-cli\\bin\\utils\\convert-argv.js',
'C:\\Users\\piyush\\whatchat\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! whatchat#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the whatchat#1.0.0 dev 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\piyush\AppData\Roaming\npm-cache\_logs\2020-12-15T14_13_28_671Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! whatchat#1.0.0 start: `npm run dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the whatchat#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\piyush\AppData\Roaming\npm-cache\_logs\2020-12-15T14_13_28_828Z-debug.log
i searched lot on Google and discord coding help servers but could not fix this please help me out
you probably didn't install cordova before try:
npm install -g cordova

Can't install 'node-sass' on Ubuntu 20

I use webpack 4, sass, pug and bemto. Module on windows worked normal, but on Ubuntu:
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! node-sass#4.14.1 postinstall: `node scripts/build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the node-sass#4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I tried enter command:
sudo npm install -g --unsafe-perm node-sass
>
(node:8310) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(Use `node --trace-deprecation ...` to show where the warning was created)
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/local/bin/node-sass -> /usr/local/lib/node_modules/node-sass/bin/node-sass
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2725/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> node-sass#4.14.1 install /usr/local/lib/node_modules/node-sass
> node scripts/install.js
Cached binary found at /root/.npm/node-sass/4.14.1/linux-x64-83_binding.node
> node-sass#4.14.1 postinstall /usr/local/lib/node_modules/node-sass
> node scripts/build.js
Binary found at /usr/local/lib/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
/snap/node/2725/bin/node: symbol lookup error: /usr/local/lib/node_modules/node-sass/vendor/linux-x64-83/binding.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionE
npm WARN You are using a pre-release version of node and things may not work as expected
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! node-sass#4.14.1 postinstall: `node scripts/build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the node-sass#4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
UPD:
I tried:
npm uninstall node-sass
After:
npm install node-sass
Did not help.
I tried:
npm install node-gyp global, save, savedev
ERROR in ./src/sсss/critical.scss (./node_modules/css-loader??ref--5-1!./node_modules/sass-loader/lib/loader.js??ref--5-2!./src/sсss/critical.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
Require stack:
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/sass-loader/lib/loader.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/loadLoader.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/NormalModule.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/NormalModuleFactory.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/Compiler.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/webpack.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack-dev-server/bin/webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1020:15)
at Function.Module._load (internal/modules/cjs/loader.js:890:27)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/sass-loader/lib/loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at loadLoader (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/loadLoader.js:18:17)
at iteratePitchingLoaders (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
at iteratePitchingLoaders (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
at /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js:176:18
at loadLoader (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/loadLoader.js:47:3)
But problem don't leave me.
Run this commands:
rm -rf ./node_modules ./package-lock.json, then
npm cache verify.
PS: I recommend to install nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Also I don’t know if you already have it, but make sure to also have build-essential install
$ sudo apt update && apt install build-essential
It is a set of c++ compilers and Bunch of useful 💩
something else that I have seen is the lack of python 2.x.x
$ sudo apt install python
Try this, it worked for me
npm i --unsafe-perm node-sass
Please check your node version before install it, node-sass has striction about node versions, shown as below:
refer to https://github.com/sass/node-sass
Cached binary found at /root/.npm/node-sass/4.14.1/linux-x64-83_binding.node
Binary found at /usr/local/lib/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
I would say the issue could be the fact it's using a cached version from before you upgraded to Ubuntu 20, in which case, removing the cached binary would resolve this.
https://docs.npmjs.com/cli-commands/cache.html
This is just my assumption, what have you tried so far to resolve this issue?

Failed to install npm dev / npm watch for Laravel 5.6

I'm working on a project in Laravel 5.6, I've installed npm successfully, but when I run npm run dev or npm run watch, I get this error:
$ npm run dev
> # dev C:\wamp64\www\QuAn
> npm run development
> # development C:\wamp64\www\QuAn
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
11% building 9/14 modules 5 active ...elector.js?type=template&index=0!C:\wamp64\www\QuAn\resources\assets\js\components\ExampleComponent.vue{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }.
78% module and chunk tree optimization unnamed compat pluginC:\wamp64\www\QuAn\node_modules\webpack\lib\Chunk.js:861
throw new Error(
^
Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
at Chunk.get (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Chunk.js:861:9)
at C:\wamp64\www\QuAn\node_modules\←[4mextract-text-webpack-plugin←[24m\dist\index.js:176:48
at Array.forEach (<anonymous>)
at C:\wamp64\www\QuAn\node_modules\←[4mextract-text-webpack-plugin←[24m\dist\index.js:171:18
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\node_modules\←[4mtapable←[24m\lib\HookCodeFactory.js:33:10), <anonymous>:12:1)
at AsyncSeriesHook.lazyCompileHook (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\node_modules\←[4mtapable←[24m\lib\Hook.js:154:20)
at Compilation.seal (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compilation.js:1342:27)
at C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compiler.js:675:18
at C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compilation.js:1261:4
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\node_modules\←[4mtapable←[24m\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
at AsyncSeriesHook.lazyCompileHook (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\node_modules\←[4mtapable←[24m\lib\Hook.js:154:20)
at Compilation.finish (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compilation.js:1253:28)
at C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compiler.js:672:17
at eval (eval at create (C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\node_modules\←[4mtapable←[24m\lib\HookCodeFactory.js:33:10), <anonymous>:11:1)
at C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compilation.js:1185:12
at C:\wamp64\www\QuAn\node_modules\←[4mwebpack←[24m\lib\Compilation.js:1097:9
←[90m at processTicksAndRejections (internal/process/task_queues.js:75:11)←[39m
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development 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\INFO\AppData\Roaming\npm-cache\_logs\2019-09-20T21_53_25_570Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev 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\INFO\AppData\Roaming\npm-cache\_logs\2019-09-20T21_53_25_604Z-debug.log
I've tried to clean the cache, delete node_modules, files and reinstall npm but nothing seems to resolve the problem.
Versions : Laravel 5.6 , Node 12.10 , npm 6.11.3
I think this solution will help you github Read JeffreyWay comment
Try doing a full reset:
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

"Cannot find module" when executing 'npm start'[How should I approach my error?]

I want to host my website using node.js.
After npm install express --save, and adding package-lock.json & package.json & Procfile & node_module & .env.
I have tried this below, but not worked.
rm -rf node_modules
npm install
What other approaches should I do? The following is my error.
> portfolio-website#1.0.0 start /Users/John/Project/portfolio-website
> node server
module.js:557
throw err;
^
Error: Cannot find module '/Users/John/Project/portfolio-website/server'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:190:16)
at bootstrap_node.js:662:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio-website#1.0.0 start: `node server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio-website#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/John/.npm/_logs/2019-01-21T00_09_21_588Z-debug.log
server folder includes server.js.
First of all, why cannot module be found? The order of path is correct.
If the server.js file is inside server folder, then you should run node server/server.js

Issue with npm start command

While setting the environment for the Vue.js app I have encountered the issue with npm start related to node_modules and nodemon.
I am getting this error in the console when running the $npm start command:
$ npm start
> server#1.0.0 start C:\Users\Michał\desktop\it\vueapptrain\server
> node .node_modules/nodemon/.bin/nodemon.js src/app.js --exec 'npm run lint && node'
module.js:515
throw err;
^
Error: Cannot find module 'C:\Users\Michał\desktop\it\vueapptrain\server\.node_modules\nodemon\.bin\nodemon.js'
at Function.Module._resolveFilename (module.js:513:15)
at Function.Module._load (module.js:463:25)
at Function.Module.runMain (module.js:653:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#1.0.0 start: `node .node_modules/nodemon/.bin/nodemon.js src/app.js --exec 'npm run lint && node'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any ideas how this can be solved?
Firstly, ensure you have nodemon installed; npm i nodemon -S.
Then, edit the start script in your package.json to this,
node ./node_modules/.bin/nodemon src/app.js --exec 'npm run lint && node'

Resources