最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - node:internalmodulescjsloader:1078 throw err; ^ - Stack Overflow

programmeradmin2浏览0评论

I am having this error in windows 10 with npm run mand :

node:internal/modules/cjs/loader:1063
 throw err;
^
Error: Cannot find module 'D:\mobile-version portfolio\
at Module._resolveFilename (node:internal/modules/cjs/loader:1060:15)
at node:internal/main/check_syntax:34:20 {
 code: 'MODULE_NOT_FOUND',
   requireStack: []
}

Node.js v19.6.0 someone help me please.

I have uninstalled and installed node.js, but didn't work for me, I also deleted node-modules and installed again but all is not working.

When I try to run any npm mand i.e npm run start, npm run build or check linter errors with npx stylelint **/*.{css,scss} it throws the same error.am working with webpack and I need to run the mand to update my changes in dist file from src file.

I also need to run and check linter errors and fix in my project. Here is my package.json file:

 "name": "to-do-list",
 "version": "1.0.0",
 "description": "README.md\r One attachment\r • Scanned by Gmail\r <a name=\"readme-top\"></a>",
 "main": "index.js",
 "private": true,
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "start": "webpack serve --open",
   "build": "webpack --config webpack.config.js"
 },


 "repository": {
   "type": "git",
   "url": "git+.git"
 },
 "keywords": [],
 "author": "",
 "license": "ISC",
 "bugs": {
   "url": ";
 },


 "homepage": ";,
 "devDependencies": {
   "@babel/core": "^7.17.8",
   "@babel/preset-env": "^7.16.11",
   "babel-eslint": "^10.1.0",
   "babel-loader": "^8.2.3",
   "css-loader": "^6.7.1",
   "eslint": "^7.32.0",
   "eslint-config-airbnb-base": "^14.2.1",
   "eslint-plugin-import": "^2.27.5",
   "hint": "^2.0.0",
   "html-webpack-plugin": "^5.5.0",
   "sass": "^1.49.9",
   "sass-loader": "^12.6.0",
   "style-loader": "^3.3.1",
   "stylelint": "^13.13.1",
   "stylelint-config-standard": "^21.0.0",
   "stylelint-csstree-validator": "^1.9.0",
   "stylelint-scss": "^3.21.0",
   "webpack": "^5.75.0",
   "webpack-bundle-analyzer": "^4.5.0",
   "webpack-cli": "^4.9.2",
   "webpack-dev-server": "^4.11.1"
 },


 "dependencies": {
   "lodash": "^4.17.21"
 }
}

I am having this error in windows 10 with npm run mand :

node:internal/modules/cjs/loader:1063
 throw err;
^
Error: Cannot find module 'D:\mobile-version portfolio\
at Module._resolveFilename (node:internal/modules/cjs/loader:1060:15)
at node:internal/main/check_syntax:34:20 {
 code: 'MODULE_NOT_FOUND',
   requireStack: []
}

Node.js v19.6.0 someone help me please.

I have uninstalled and installed node.js, but didn't work for me, I also deleted node-modules and installed again but all is not working.

When I try to run any npm mand i.e npm run start, npm run build or check linter errors with npx stylelint **/*.{css,scss} it throws the same error.am working with webpack and I need to run the mand to update my changes in dist file from src file.

I also need to run and check linter errors and fix in my project. Here is my package.json file:

 "name": "to-do-list",
 "version": "1.0.0",
 "description": "README.md\r One attachment\r • Scanned by Gmail\r <a name=\"readme-top\"></a>",
 "main": "index.js",
 "private": true,
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "start": "webpack serve --open",
   "build": "webpack --config webpack.config.js"
 },


 "repository": {
   "type": "git",
   "url": "git+https://github./Tracy-miranja/TO-DO-LIST.git"
 },
 "keywords": [],
 "author": "",
 "license": "ISC",
 "bugs": {
   "url": "https://github./Tracy-miranja/TO-DO-LIST/issues"
 },


 "homepage": "https://github./Tracy-miranja/TO-DO-LIST#readme",
 "devDependencies": {
   "@babel/core": "^7.17.8",
   "@babel/preset-env": "^7.16.11",
   "babel-eslint": "^10.1.0",
   "babel-loader": "^8.2.3",
   "css-loader": "^6.7.1",
   "eslint": "^7.32.0",
   "eslint-config-airbnb-base": "^14.2.1",
   "eslint-plugin-import": "^2.27.5",
   "hint": "^2.0.0",
   "html-webpack-plugin": "^5.5.0",
   "sass": "^1.49.9",
   "sass-loader": "^12.6.0",
   "style-loader": "^3.3.1",
   "stylelint": "^13.13.1",
   "stylelint-config-standard": "^21.0.0",
   "stylelint-csstree-validator": "^1.9.0",
   "stylelint-scss": "^3.21.0",
   "webpack": "^5.75.0",
   "webpack-bundle-analyzer": "^4.5.0",
   "webpack-cli": "^4.9.2",
   "webpack-dev-server": "^4.11.1"
 },


 "dependencies": {
   "lodash": "^4.17.21"
 }
}
Share Improve this question edited Feb 27, 2023 at 6:20 Sydney_dev 1,3802 gold badges18 silver badges26 bronze badges asked Feb 26, 2023 at 5:48 tracytracy 1011 gold badge1 silver badge4 bronze badges 2
  • were you able to resolve this? I am facing the same issue – Standin.Wolf Commented Apr 22, 2023 at 19:14
  • The error message says "Cannot find module D:\mobile-version portfolio\". It probably wants one or more files, but you're giving it a directory. What's inside of that directory? Any CSS files? ~ * ~ Remended reading: Read the error message! – Henke - Нава́льный П с м Commented Jan 26, 2024 at 14:34
Add a ment  | 

5 Answers 5

Reset to default 3

You are just opening the terminal in the wrong folder.

The index file is inside the BestMe folder: ~/Desktop/Programação/Rocketseat/Discover/NodeJS/BestMe

The First Way

The Second Way

Using this mand :

npm i -f
npm update -f
npm audit fix -f

npm replaced by npx =>

npx nodemon 

if you not install nodemon then firstly install nodemon using this mand :

npm i nodemon --force

npx nodemon

Installing stylelint globally 'worked' for me. npm i -g stylelint@version You can try it till a better solution is given.

check for extension, I had faced same problem, which was because of index,js name of the file, which should have been index.js instead. Silly mistake, I know.

If you are following course 'The Complete 2023 Web Development Bootcamp by dr angela yu' and getting an error like: node:internal/modules/cjs/loader:1078 throw err; then you have not followed all steps correctly. I forgot to remove the line 'const date = require(__dirname + "/date.js");' so I was getting an error : enter image description here

发布评论

评论列表(0)

  1. 暂无评论