I can't seem to run npm run dev or npm start on my macOS machine.
I get a bus error message every time I try to do so, and the output is usually something like this:
klvn git:(main) ✗ npm run dev
> klvn#0.1.0 dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
[1] 1736 bus error npm run dev
➜ klvn git:(main) ✗
I've tried removing the /node_modules, package-lock.json and /.next folders but that doesn't seem to help.
I'm running macOS Monterey.
The issues actually with node_modules and the package-lock.json file. Delete the following first:
delete node_modules directory
delete the package-lock.json file
And then run:
npm install
npm run dev
or any other npm command.
I had this same error with a project I cloned from a repo.
My solution was to delete the local version of it and then clone it again. Then run an npm install and then the npm run dev script again.
I am using Lerna (https://github.com/lerna/lerna) for managing my monorepo with the following structure:
-yarn.lock
-package.json
-node_modules
-packages
--app
---app1
----package.json
----src
----dist
(The above structure is the minimal example I could give, actual project has many more sub repos but this is the only one that's built on Jenkins.)
On my local machine with Yarn and NPM version as follows:
yarn: 1.22.10
node: v12.14.1
I run the following commands to build my APP1 from my root directory
yarn
cd ./packages/app/app1
yarn build
which generates dist folder in packages/app/app1.
But when I run the same set of commands on Jenkins I get the following error:
error No lockfile in this directory. Run yarn install to generate one.
error Command failed with exit code 1.
Since I'm using lerna, my lockfile is in root directory. Why am I getting this error? Why not on local machine?
Node and Yarn versions on Jenkins:
yarn: 1.9.10
node: v12.16.1
follow the tips run "yarn install",then run "yarn upgrade"
Whenever I run npm run dev I get this error.
I've tried to delete node_modules and reinstall it using npm install but that didn't work. Then I tried to delete both node_modules and package-lock.json and reinstall them, that didn't work. I even tried upgrading Node to the latest version, but I'm still getting this issue.
I appreciate any help I get. Thank you in advance.
Error: Cannot find module 'C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\postcss\lib\parser'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:952:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:945:15)
at resolveExports (node:internal/modules/cjs/loader:473:14)
at Function.Module._findPath (node:internal/modules/cjs/loader:513:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:911:27)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.552 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11590)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.560 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:400)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.290 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:260)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.632 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:3733)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\jaydev\\Desktop\\ecommerce\\fashionsite\\node_modules\\postcss\\package.json'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fashionsite#0.1.0 dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fashionsite#0.1.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\jaydev\AppData\Roaming\npm-cache\_logs\2020-12-25T07_06_40_981Z-debug.log
package.json:
{
"name": "fashionsite",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "10.0.4",
"react": "17.0.1",
"react-dom": "17.0.1"
}
}
stop your dev server (ctrl+c)
delete .next folder in your project's root folder.
delete node_modules folder and package-lock.json file too.
run npm cache clean --force
run npm install
run npm run dev
If the above didn't work then open your file explorer and see if the specified file exists on the specified path or not:
C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\postcss\lib\parser.js
if it exists try moving your project's folder to a path other than desktop due to windows permission problems and let me know if the problem is resolved.
In my case it turned out to be a problem with windows permissions. My project was on Desktop and changing its location to a directory with more permissions helped.
I had a similar issue and found that when I was running npm install after removing node_modules it wasn't correctly installing all the dependencies because my node version had switched back to an older version.
Make sure your environment is configured correctly first. For me:
nvm use 16.0.0 and then npm install
Also, when you run npm install are there any messages that come up in the command line saying saying a dependency isn't met or something like that, might give you some hints of where to look.
move next.config.js file from you project folder then execute npm run dev.
or
comment the contents of next.config.js.
any of the above methods will help run npm run dev.
make sure u already update/upgrade
sudo apt update
sudo apt upgrade
after u run this command
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash
sudo apt-get install -y nodejs
sudo apt install npm
use latest node js repo avoid using sudo apt install nodejs..outdated..
To get rid of this error what you have to do...
just update your node.js version
Hopefully, it will help you.
I also got this error:
$ npm run start
> kalyna#0.1.0 start
> next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - [next-export-optimize-images]: Configuration was not loaded. (This is optional.)
Error: Cannot find module '/home/matachi/proj/kalyna/.next/server/pages/index.js'
Require stack:
- /home/matachi/proj/kalyna/node_modules/next/dist/server/require.js
- /home/matachi/proj/kalyna/node_modules/next/dist/server/next-server.js
- /home/matachi/proj/kalyna/node_modules/next/dist/server/next.js
- /home/matachi/proj/kalyna/node_modules/next/dist/server/lib/start-server.js
- /home/matachi/proj/kalyna/node_modules/next/dist/cli/next-start.js
- /home/matachi/proj/kalyna/node_modules/next/dist/lib/commands.js
- /home/matachi/proj/kalyna/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.mod._resolveFilename (/home/matachi/proj/kalyna/node_modules/next/dist/build/webpack/require-hook.js:27:32)
at Function.mod._resolveFilename (/home/matachi/proj/kalyna/node_modules/next/dist/build/webpack/require-hook.js:27:32)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.requirePage (/home/matachi/proj/kalyna/node_modules/next/dist/server/require.js:58:12)
at /home/matachi/proj/kalyna/node_modules/next/dist/server/load-components.js:61:73
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.loadComponents (/home/matachi/proj/kalyna/node_modules/next/dist/server/load-components.js:61:26) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/matachi/proj/kalyna/node_modules/next/dist/server/require.js',
'/home/matachi/proj/kalyna/node_modules/next/dist/server/next-server.js',
'/home/matachi/proj/kalyna/node_modules/next/dist/server/next.js',
'/home/matachi/proj/kalyna/node_modules/next/dist/server/lib/start-server.js',
'/home/matachi/proj/kalyna/node_modules/next/dist/cli/next-start.js',
'/home/matachi/proj/kalyna/node_modules/next/dist/lib/commands.js',
'/home/matachi/proj/kalyna/node_modules/next/dist/bin/next'
]
}
I fixed it by deleting the .next directory and restarting the dev server:
$ rm -rf .next
$ npm run dev
> kalyna#0.1.0 dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - [next-export-optimize-images]: Configuration was not loaded. (This is optional.)
event - compiled client and server successfully in 9.9s (173 modules)
wait - compiling / (client and server)...
event - compiled client and server successfully in 1809 ms (300 modules)
My solution to that is updating my node version. I got the same error in 10.18. version and I upgraded to the latest and it works fine already, maybe it will works for you too.
Hope it helps this issue.
it also works in 17.3.0 but right this moment the latest is 18.12.0.
I had the same problem. I tried to document about the issue, followed the most voted answers. Finally I found the solution by just following the linked explanation: https://nextjs.org/docs/messages/module-not-found.
The swr module has to be installed using a package manager.
When using npm: npm install swr
When using yarn: yarn add swr
where swr is the missing module. In my case as my missing module was graphql:
yarn add graphql
did the trick
Make sure you are in the right directory when using npm run dev.
You can also try switching to yarn.
I found this article helpful ->
https://hidayatabisena.medium.com/how-to-solve-npm-err-code-elifcycle-when-running-npm-run-dev-on-your-next-js-project-4794226d040f
I'm using Windows 10, IntelliJ 2020.1 and Node 12
When I run "npm install" from the terminal inside IntelliJ, everything installs like normal. However, when I make an edit to my package.json file and click "Run 'npm install" in the popup in the lower right corner, I receive the follow error:
Specify configs in the ini-formatted file:
C:\Users\me\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#6.14.4 C:\Users\me\AppData\Roaming\npm\node_modules\npm
Process finished with exit code 1
Am I overlooking a simple IntelliJ config setting? Appreciate any help.
====
and the last entry in the log before the error mentioned above:
at com.intellij.javascript.nodejs.packages.NodePackageUtil.doLoadPackageInfo(NodePackageUtil.java:112)
at com.intellij.javascript.nodejs.packages.NodePackageUtil.loadPackageInfo(NodePackageUtil.java:71)
at com.intellij.javascript.nodejs.settings.NodePackageInfoManager$1.fetch(NodePackageInfoManager.java:23)
at com.intellij.javascript.nodejs.settings.NodePackageInfoManager$1.fetch(NodePackageInfoManager.java:19)
at com.intellij.lang.javascript.bower.cache.PrevRequestSkippingCache.lambda$fetchSync$2(PrevRequestSkippingCache.java:82)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.lang.javascript.bower.cache.PrevRequestSkippingCache.fetchSync(PrevRequestSkippingCache.java:92)
at com.intellij.lang.javascript.bower.cache.PrevRequestSkippingCache.lambda$fetchAsync$1(PrevRequestSkippingCache.java:72)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:210)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-04-27 18:45:43,643 [101269107] WARN - ckaging.InstalledPackagesPanel - Cannot fetch the latest version of the installed package npm
com.intellij.javascript.nodejs.packages.NodePackageInfoException: FAILED COMMAND: "C:\Program Files\nodejs\npm.cmd" C:\Users\me\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js info --json npm
EXIT CODE: 1```
You have specified npm.cmd as a Node.js interpreter, but it's not an interpreter, it's a package manager run with Node.js. Please specify a valid path to node.exe - must be C:\Program Files\nodejs\node.exe
I got a project that I need to work on. I forked the project from gitlab, unzipped it into my workspace folder, ran terminal and the following commands
node --version
npm --version
npm install
npm init
npm start
This should have installed all devDependencies (I turned production to false) and the server should be up and running. However, I'm getting the following error
`ERROR in .//src/client/index.js
Module build failed: Error: No ESLint configuration found.
at getLocalConfig ((dir)\node_modules\eslint\lib\config.js:162:35)
at Config.getConfig ((dir)\node_modules\eslint\lib\config.js:259:26)
at processText ((dir)\node_modules\eslint\lib\cli-engine.js:224:33)
at CLIEngine.executeOnText ((dir)\node_modules\eslint\lib\cli-engine.js:754:26)
at lint ((dir)\node_modules\eslint-loader\index.js:44:31)
at Object.module.exports ((dir)\node_modules\eslint-loader\index.js:181:3)
webpack: Failed to compile.`
I do have a eslintrc both on root dir and /src/client. What am I missing here ?