Error enoent no such file or directory lstat index pug

Not recognizing spaces in directory when runing pug —watch [dir] #2519 Comments So I am trying to run pug watch — after installing successfully but when I run it, it tells me it could not find the project (my name has a space): C:UsersJuan DiegoDesktopWebsitesVAHO>pug —watch C:UsersJuan DiegoDesktopWebsitesVAHO Error: ENOENT: no such file or […]

Содержание

  1. Not recognizing spaces in directory when runing pug —watch [dir] #2519
  2. Comments
  3. Cannot compile all pug’s files on project in one script command, please help! #2881
  4. Comments
  5. Additional Comments
  6. Fix Nodejs Error: ENOENT: no such file or directory
  7. Fix Nodejs Error: ENOENT: no such file or directory
  8. Solution
  9. Error: ENOENT: no such file or directory, copyfile #5275
  10. Comments
  11. Uncaught Error: ENOENT: no such file or directory, lstat ‘/nuclide:’ #233
  12. Comments
  13. Stack Trace
  14. Commands
  15. Config
  16. Installed Packages

Not recognizing spaces in directory when runing pug —watch [dir] #2519

So I am trying to run pug watch — after installing successfully but when I run it, it tells me it could not find the project (my name has a space):

C:UsersJuan DiegoDesktopWebsitesVAHO>pug —watch C:UsersJuan DiegoDesktopWebsitesVAHO

Error: ENOENT: no such file or directory, lstat ‘C:UsersJuan’
at Error (native)
at Object.fs.lstatSync (fs.js:839:18)
at renderFile (C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:246:17)
at tryRender (C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:209:5)
at C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:149:5
at Array.forEach (native)
at Object. (C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:148:9)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
Error: ENOENT: no such file or directory, lstat ‘C:UsersJuan DiegoDesktopWebsitesVAHODiegoDesktopWebsitesVAHO’
at Error (native)
at Object.fs.lstatSync (fs.js:839:18)
at renderFile (C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:246:17)
at tryRender (C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:209:5)
at C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:149:5
at Array.forEach (native)
at Object. (C:UsersJuan DiegoAppDataRoamingnpmnode_modulespug-cliindex.js:148:9)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)

Will I need to change my user name in windows??

The text was updated successfully, but these errors were encountered:

Источник

Cannot compile all pug’s files on project in one script command, please help! #2881

Pug Version: 2.0.0-rc.4

Node Version: v8.6.0

I cannot compile all pug’s files in one script command, please help!
I use VSCode
In package.json I set «scripts»: <«pug»: «pug components/<**/**,**>/*.pug —no-debug —client —name-after-file —extension=pug.js»> to compile all pug’s file in «components» dir,
and run it as — $ npm run pug

And every time i got an error:

components_1808_2130@1.0.0 pug C:UsersmikhaDownloadscomponents_1808_2130
pug components/</,**>/*.pug —no-debug —client —name-after-file —extension=pug.js

fs.js:948
binding.lstat(pathModule._makeLong(path));
^
Error: ENOENT: no such file or directory, lstat ‘C:UsersmikhaDownloadscomponents_1808_2130components<**,>*.pug’
at Object.fs.lstatSync (fs.js:948:11)
at renderFile (C:UsersmikhaDownloadscomponents_1808_2130node_modulespug-cliindex.js:246:17)
at C:UsersmikhaDownloadscomponents_1808_2130node_modulespug-cliindex.js:149:5
at Array.forEach ()
at Object. (C:UsersmikhaDownloadscomponents_1808_2130node_modulespug-cliindex.js
:148:9)

If i do not use «*» simvol in command — all works fine, if i try to use *.pug — i got en error.
What i do wrong!? help please

The text was updated successfully, but these errors were encountered:

Источник

Fix Nodejs Error: ENOENT: no such file or directory

This tutorial guides you on how to fix Nodejs Error: ENOENT: no such file or directory while running your node project or any application which contains Nodejs component.

Fix Nodejs Error: ENOENT: no such file or directory

When I tried to download guacamole-client whose frontend is developed using Nodejs, and I tried to setup installing guacamole natively on Windows machine.

After downloading the code, I was trying to build guacamole-client which includes Nodejs frontend component by running “mvn package” command as shown below. But it resulted with error “ Error: ENOENT: no such file or directory, open ‘C:UsersDocumentsWorkguacamole-client-masterguacamolesrcmainfrontenddistnpm-dependencies.txt’

The above command “mvn package” is supposed to invoke maven to automatically build and package all the components, producing a single .war file. And while building frontend Nodejs component, it was looking for a file called “npm-depedencies.txt” but that file is missing.

Solution

As you can see from the above error, that it is expecting file called “npm-dependencies.txt” to be there in specific path. But it does not exist.

ENOENT means Error NO ENTry (or Error NO ENTity) or simply you can say that there is NO such directory ENTry.

Therefore, you either need to create the expected file in the specific path i.e., under dist directory or else reconfigure your application so that it will point to the correct directory path for the required file.

After fixing, try building your application again. The Nodejs Error: ENOENT: no such file or directory should have gone away now.

Источник

Error: ENOENT: no such file or directory, copyfile #5275

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When having a yarn workspace, adding one of the packages to another and then executing yarn install throws this error:

Error: ENOENT: no such file or directory, copyfile ‘/Users/tim/Library/Caches/Yarn/v1/npm-jsonfile-4.0.0-8771aae0799b64076b76640fca058f9c10e33ecb/CHANGELOG.md’ -> ‘/Users/tim/code/prisma-deployment-test/cli/node_modules/prisma-yml/node_modules/jsonfile/CHANGELOG.md’

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
Execute yarn install without throwing an error.

Please mention your node.js, yarn and operating system version.
yarn@1.4.0
node@9.4.0
macOS Sierra@10.12.6

The text was updated successfully, but these errors were encountered:

That’s a strange one. Even after it errors, I can stat both the «from» and «to» files reported in the error, and they both exist 😕

I was having a similar issue but worked around it by removing node_modules . Guess that’s not the most friendly solution here, though.

When I just tried to reproduce the bug, I got there error already during the «yarn add -E prisma-yml» step. The «no such file or directory» message was appropriate here since the target directory cli/node_modules/prisma-yml/node_modules/jsonfile really didn’t exist.

rm -rf node_modules && yarn cache clean && yarn install solves most such problems.

For what it’s worth, I wasn’t able to cure with the steps Markus suggests. I even tried reinstalling yarn and manually deleting the yarn cache using rm -fr

I did find a partial solution. I’m posting here in hopes it sheds light on what the underlying issue might be. Bullet 4 below shows how I fixed it.

  1. The file causing the ENOENT error is a dependency of a private module I added using yarn add ssh+git://git@github.com/me/myprivatemodule.git . To be specific, myprivatemodule depends on mathjs , and yarn install was stopping with:

error An unexpected error occurred: «https://registry.yarnpkg.com/mathjs/-/mathjs-5.0.2.tgz: ENOENT: no such file or directory, open ‘/Users/aneil/Library/Caches/Yarn/v1/npm-mathjs-5.0.2-ed23dcfb40e886697447bcfe43e5dc5d92dd8eb0/docs/reference/functions/permutations.md’».

  1. Looking in the Yarn cache, I noticed (after attempting to install with a clean cache) that I had two copies of mathjs:

And. the 5.0.2 directory was empty, which is why I was seeing the error.

It’s worth noting that I was attempting to yarn install a freshly cloned repo on a new machine

Running yarn add ssh+git://git@github.com/me/myprivatemodule.git fixed the problem

I can reproduce the error with

So, although I can continue development, I suspect my CI is borked.

Update:
I see why I have two copies of the offending module — another dependency of my private module depends on the 3.20.2 version of mathjs. However, making myprivatemodule use the same version of mathjs doesn’t solve the issue.

Источник

Uncaught Error: ENOENT: no such file or directory, lstat ‘/nuclide:’ #233

[Enter steps to reproduce below:]

Atom Version: 1.8.0
System: Mac OS X 10.11.5
Thrown From: fuzzy-finder package, v1.0.5

Stack Trace

Uncaught Error: ENOENT: no such file or directory, lstat ‘/nuclide:’

Commands

Config

Installed Packages

The text was updated successfully, but these errors were encountered:

This problem break fuzzy search on remote project.

This should be fixed in Atom 1.9.0-beta0 and above.

I am experiencing the same problem at Atom 1.9.0-beta0.

@vtambourine Ok, thanks for reporting back. Does the issue still occur in safe mode ( atom —safe )?

@50Wliu no, in safe mode no error of that kind. Error is occurring only if I connected to the remote host via Nuclide package.

@vtambourine Can you also report this to Nuclide? I’m not sure who’s at fault here, so I’m going to reopen this issue in the meantime.

In Nuclide, when there are remote projects, the paths of those projects are actually URIs. An example of two projects (one local one remote) below:

My guess is that fuzzy-finder is making the assumption that these will just be normal OS paths, and there’s some parsing trouble due to that

It looks like maybe here

there should be a filter on the atom.project.getPaths() array with some validation function that would exclude these URI-style paths.

Thanks for the info @johnislarry.

I’m on Atom 1.16.0 now, and problem still occurs.
On the other hand, problem occurs only when trying to search via Cmd + P . Fuzzy search made via Nuclide package on Cmd + T works well.

Источник

An unhandled exception occurred:

ENOENT: no such file or directory, lstat 
'/Users/Desktop/node_modules'
See "/private/var/folders/3p/l_k1wk8n76v3cfwnxk0blx000000gn/T/ng- 
DF5EZ7/angular-errors.log" for further details.

Whenever i am doing ng serve, this error occurs,
Can anyone tell me what is the cause of error.
stuck in this since long hours.

Daniel B's user avatar

Daniel B

8,6515 gold badges45 silver badges75 bronze badges

asked Mar 12, 2021 at 9:44

shristy sinha's user avatar

4

I had this problem, it was just:

  1. Works
    «styles»: [
    «node_modules/bootstrap/dist/css/bootstrap.min.css»

  2. Not works
    «styles»: [
    «../node_modules/bootstrap/dist/css/bootstrap.min.css»

answered May 14, 2021 at 2:35

Manuel Villadiego's user avatar

1

I had the same error when I tried installing an old version of bootstrap and referenced it in the angular.json file. Meanwhile, the package was never installed because it doesn’t exist anymore. Check the new command for installing a particular package and after doing npm i <package-name> check in node_modules if it’s there.

And also, I changed my bootstrap path
from

../node_modules/bootstrap/dist/css/bootstrap.css

to

node_modules/bootstrap/dist/css/bootstrap.css

F.zehra's user avatar

answered Mar 20, 2021 at 4:55

Elvis020's user avatar

Elvis020Elvis020

4002 silver badges6 bronze badges

In my case, my problem was a misspelling issue in the directory URL inside Angular.json. So I corrected the error and the apps run perfectly afterwards.

Not working: (misspelled on «node_modules»)

"styles": ["./node_moodules/font-awesome/css/font-awesome.css"]

Working:

"styles": ["./node_modules/font-awesome/css/font-awesome.css"]

try checking your url path in Angular.json, this probably the case, hopefully this helps!

answered Jun 22, 2021 at 2:09

Maidenless Runt's user avatar

I got into this issue after installing ngx-bootstrap

> ng add ngx-bootstrap

Following went in angular.json

"styles": [
 "./dist/ngx-bootstrap/datepicker/bs-datepicker.css",
 "./node_modules/bootstrap/dist/css/bootstrap.min.css",
 "src/styles.css"
]

Changed to following and error got fixed

"styles": [
  "node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "src/styles.css"
]

answered Jun 26, 2022 at 23:57

learning...'s user avatar

learning…learning…

3,0569 gold badges58 silver badges92 bronze badges

Solving the problems on angular.json then deleting package-lock.json solved my problem.

My problem was related to a deleted package @angular/material. Angular.json styles were still referencing that package, I deleted those lines. Then I deleted the package-lock.json and execute it.

answered Jun 7, 2021 at 8:45

F.zehra's user avatar

I had the same problem. But I found a Solution which works for me.

Try:

npm install —save bootstrap

and then add in angular.json at «styles»:

«node_modules/bootstrap/dist/css/bootstrap.min.css»

run the Project (Watch if youre in the right folder you can check it with typing in terminal ls and and then you should see node_modules, src etc.)

ng serve

answered Jul 7, 2021 at 8:30

Dopaemin's user avatar

1

if: npm install bootstrap
then «./node_modules/bootstrap/dist/css/bootstrap.min.css»

if npm install —save bootstrap
then «node_modules/bootstrap/dist/css/bootstrap.min.css»

answered Oct 23, 2021 at 17:30

akSingh's user avatar

I was facing similar error:

 An unhandled exception occurred: ENOENT: no such file or directory, lstat 
'C:User_NameAngularnode_modulesbootstrap'
See "C:UsersUser_NameAppDataLocalTempng-MhR1Lsangular-errors.log" for further details.

This was caused due to adding this in styles array:

    "styles": [
          "src/styles.css",
          "../node_modules/bootstrap/dist/css/bootstrap.min.css"
        ]

Solved it by changing styles array with

    "styles": [
          "src/styles.css",
          "node_modules/bootstrap/dist/css/bootstrap.min.css"
        ]

This may have happened cause I made another angular project inside the parent folder or directory since «.» denotes the home directory.
This is just my understanding and the solution of the issue.

Please check whether you have added your current component.html file i.e. unique selector in your app.component.html file

Recently started my angular journey so cheers!!

answered Jan 26, 2022 at 12:36

Ashutosh's user avatar

Just do:

npm install --force and then npm audit fix --force

answered Mar 11, 2022 at 8:03

Shier Vermont Morada Reyes's user avatar

As @Manuel Villadiego said, you must define your bootstrap path like below:

«node_modules/bootstrap/dist/css/bootstrap.min.css»

Or

«./node_modules/bootstrap/dist/css/bootstrap.min.css»

This error will happen when you start bootstrap path with ../ ,

«../node_modules/bootstrap/dist/css/bootstrap.min.css»

because you go back one folder and node_modules folder doesn’t exist there.

answered Aug 3, 2021 at 6:53

Abbas Jafari's user avatar

Abbas JafariAbbas Jafari

1,3621 gold badge14 silver badges28 bronze badges

I’m had the same problem with my angular project after installing Boostrap.

My approach was:

angular.json file should have this under styles. "./node_modules/bootstrap/dist/css/bootstrap.min.css", "src/styles.css"

Then import in the main style.css file.

@import url('../node_modules/bootstrap/dist/css/bootstrap.min.css');

Make sure the path for node_modules is correct,

After making those changes I ran ng serve or npm start
Angular app is running

answered Apr 5, 2022 at 10:38

Josphat Mwania's user avatar

check angular.json file. sometimes style css pointing to the node modules may be incorrect

 "styles": [
 "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss",
              "node_modules/primeicons/primeicons.css",
              "node_modules/primeng/resources/themes/lara-light-blue/theme.css",
              "node_modules/primeng/resources/primeng.min.css"
        ],

answered Apr 13, 2022 at 18:17

Ashik T M's user avatar

Ashik T MAshik T M

231 silver badge7 bronze badges

1

I think the issue could be one of many flavors.
Mine was specifically, in the relative path of bootstrap.min.css that was specified in angular.json

The error message that I had in the logs was:
"[error] Error: ENOENT: no such file or directory, lstat 'C:Usersarsthnode_modules'"

I was following a tutorial video and provided the path as ../node_modules/bootstrap/dist/css/bootstrap.min.css.

But in my project, the angular.json file is actually at the same level as the node_modules folder. So correcting the above entry to
./node_modules/bootstrap/dist/css/bootstrap.min.css
solved the issue.

Philippe's user avatar

Philippe

7456 silver badges10 bronze badges

answered May 24, 2022 at 17:29

suramana's user avatar

  1. Download manually bootstrap from https://www.npmjs.com/package/bootstrap .
  2. Copy and past the folder you download to /Users/Desktop/node_modules .
  3. In CMD, enter to your project folder you created by typing: CD yourProjectName .
  4. In CMD: ng serve.
  5. In your browser: http://localhost:4200/

answered Apr 16, 2021 at 10:54

HELLO WORLD's user avatar

In my case i removed the «../node_modules/bootstrap/dist/css/bootstrap.min.css» from angular.json

answered Jun 1, 2021 at 23:57

Breno AllenCS's user avatar

I had this problem on a non-Angular project; here’s what worked for me:

  1. update node and npm
  2. delete package-lock.json
  3. run npm install --package-lock-only

answered Jul 24, 2021 at 19:44

nydame's user avatar

nydamenydame

3144 silver badges8 bronze badges

Usually, it happens when

package-lock.json

was created by another version of the node js (I’m using the latest LTS version).

Just remove it and try again, this is OK.

answered Oct 4, 2021 at 16:51

Ammar Khaliq's user avatar

I just had the same issue, I removed the followings from angular.json which I had just added and the issue is resolved.

          "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
          "src/styles/styles.scss",
          "src/styles/colors.scss"

answered Dec 9, 2021 at 9:10

CodeLearner's user avatar

CodeLearnerCodeLearner

1152 silver badges7 bronze badges

Step 1) npm install --save bootstrap

Step 2) and then add in angular.json at «styles»:
«./node_modules/bootstrap/dist/css/bootstrap.min.css»,

Step 3) ng serve

Problem solved

image showing the solution

Suraj Rao's user avatar

Suraj Rao

29.3k11 gold badges96 silver badges103 bronze badges

answered Dec 19, 2021 at 8:38

iOZDev's user avatar

iOZDeviOZDev

2332 silver badges6 bronze badges

I removed the file from angular.json and added it to style.css.

@import '../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css'

RiveN's user avatar

RiveN

2,56711 gold badges11 silver badges26 bronze badges

answered Feb 8, 2022 at 12:45

Gustavo's user avatar

Angular.js & Wrong Directions.

First of all, open a file called angular.js in the root folder.

And check if you add some wrong Directory. like the style or something like that. as example.

Suppose you add the bootstrap dependency and you want to add it to your project you will go to the angular.js and add it in the style configuration. so you will add it as the below:

 "styles": [
              "../node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles.css"
            ],

Check if you add double dot .. not one dot in the path like the below:

"../node_modules/bootstrap/dist/css/bootstrap.min.css",

Correct format is as the below :

"./node_modules/bootstrap/dist/css/bootstrap.min.css",

answered Apr 22, 2022 at 20:32

Abd Abughazaleh's user avatar

Abd AbughazalehAbd Abughazaleh

4,0482 gold badges38 silver badges49 bronze badges

In the angular.json file just do this change :

«styles» : [ «node_modules/bootstrap/dist/css/bootstrap.min.css»,
«src/styles.css» ]

answered May 4, 2022 at 5:26

Mounesh's user avatar

MouneshMounesh

4253 silver badges18 bronze badges

remove all node_module or remove node_moules folder and type
npm install

answered Jul 6, 2022 at 13:37

user2308728's user avatar

Bumped against the same issue with the quickstart tutorial. After restarting the tutorial and using yarn instead of npm, everything seems working fine.

answered Aug 22, 2022 at 20:56

haddassah S's user avatar

You need to check with the path of bootstrap in angular.json inside architect then styles

answered May 20, 2021 at 6:08

Ayush Kumar Sinha's user avatar

2

Pug Version: 2.0.0-rc.4

Node Version: v8.6.0

Additional Comments

I cannot compile all pug’s files in one script command, please help!
I use VSCode
In package.json I set "scripts": {"pug": "pug components/{**/**,**}/*.pug --no-debug --client --name-after-file --extension=pug.js"} to compile all pug’s file in «components» dir,
and run it as — $ npm run pug

And every time i got an error:

components_1808_2130@1.0.0 pug C:UsersmikhaDownloadscomponents_1808_2130
pug components/{/,**}/*.pug —no-debug —client —name-after-file —extension=pug.js

fs.js:948
binding.lstat(pathModule._makeLong(path));
^
Error: ENOENT: no such file or directory, lstat ‘C:UsersmikhaDownloadscomponents_1808_2130components{**,}*.pug’
at Object.fs.lstatSync (fs.js:948:11)
at renderFile (C:UsersmikhaDownloadscomponents_1808_2130node_modulespug-cliindex.js:246:17)
at C:UsersmikhaDownloadscomponents_1808_2130node_modulespug-cliindex.js:149:5
at Array.forEach ()
at Object. (C:UsersmikhaDownloadscomponents_1808_2130node_modulespug-cliindex.js
:148:9)

If i do not use «*» simvol in command — all works fine, if i try to use *.pug — i got en error…
What i do wrong!? help please

Сегодня я пытался установить зависимости в одном проекте на общем с другими разработчиками серваке. Использовал для установки зависимостей из package.json npm install. Всё стандартно, ничего необычного, локально на своей машине с CentOS 7 я делал это много раз, и проблем никогда не наблюдалось. Но тут что-то пошло не так, и мне вылетела странная ошибка error: npm ERR! Error: ENOENT, lstat. Надписи на экране стали пугающе красными.

Я попытался перезапустить установку, но результатов эти действия никаких не дали. Немного побеседовав с Гуглом, нашёл лаконичное и простое решение своей проблемы на github’е:

npm cache clean

И всё! Проблема решена, и экран окрасился в приятные зелёные тона. Магия, скажете вы. А смысл прост: эта команда очищает все коряво установленные пакеты в вашей локальной папке пакетов node_modules, которые и вызывают ошибки при установке.

По причине этих кривых пакетов у нас npm install и не завершался нормально. npm cache clean удалит эти нехорошие пакеты, и после этого вы сможете спокойно вызывать npm install или npm install -g <package_name>. Проблем возникнуть не должно. Ну лично у меня после очистки кэша всё сразу поставилось гладко.

Если вам этот совет помог, поделитесь ссылкой на решение со своими друзьями и коллегами! :)

Пытаюсь создать простое десктопное приложение на javascript, но никак не получается билдить проект.

Пишу в консоли nwbuild ./ -p win32, win64 -o ./ —cacheDir ./
и получаю пустую папку. Что я не так делаю? Заранее спасибо.

Вот что вивела консоль:

{ Error: ENOENT: no such file or directory, lstat 'C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-buildercache.27.1win32ffmpegsumo.dll'
    at Object.fs.lstatSync (fs.js:946:11)
    at Object.lstatSync (C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-buildernode_modulesfs-extranode_modulesgraceful-fspolyfills.js:297:22)
    at C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-builderlibutils.js:86:28
    at tryCatch2 (C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-buildernode_modulesbluebirdjsmainutil.js:73:19)
    at Promise$_resolveFromResolver [as _resolveFromResolver] (C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-buildernode_modulesbluebirdjsmainpromise.js:595:13)
    at new Promise (C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-buildernode_modulesbluebirdjsmainpromise.js:87:37)
    at Object.copyFile (C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-builderlibutils.js:85:16)
    at C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-builderlibindex.js:351:36
    at Array.forEach (native)
    at C:UsersukranAppDataRoamingnpmnode_modulesnode-webkit-builderlibindex.js:343:24
  errno: -4058,
  code: 'ENOENT',
  syscall: 'lstat',
  path: 'C:\Users\ukran\AppData\Roaming\npm\node_modules\node-webkit-builder\cache\0.27.1\win32\ffmpegsumo.dll' }

An unhandled exception occurred:

ENOENT: no such file or directory, lstat 
'/Users/Desktop/node_modules'
See "/private/var/folders/3p/l_k1wk8n76v3cfwnxk0blx000000gn/T/ng- 
DF5EZ7/angular-errors.log" for further details.

Whenever i am doing ng serve, this error occurs,
Can anyone tell me what is the cause of error.
stuck in this since long hours.

11 Answers

I had this problem, it was just:

  1. Works
    «styles»: [
    «node_modules/bootstrap/dist/css/bootstrap.min.css»

  2. Not works
    «styles»: [
    «../node_modules/bootstrap/dist/css/bootstrap.min.css»

I had the same error when I tried installing an old version of bootstrap and referenced it in the angular.json file. Meanwhile, the package was never installed because it doesn’t exist anymore. Check the new command for installing a particular package and after doing npm i <package-name> check in node_modules if it’s there.

And also, I changed my bootstrap path
from

../node_modules/bootstrap/dist/css/bootstrap.css

to

node_modules/bootstrap/dist/css/bootstrap.css

Solving the problems on angular.json then deleting package-lock.json solved my problem.

My problem was related to a deleted package @angular/material. Angular.json styles were still referencing that package, I deleted those lines. Then I deleted the package-lock.json and execute it.

  1. Download manually bootstrap from https://www.npmjs.com/package/bootstrap .
  2. Copy and past the folder you download to /Users/Desktop/node_modules .
  3. In CMD, enter to your project folder you created by typing: CD yourProjectName .
  4. In CMD: ng serve.
  5. In your browser: http://localhost:4200/

In my case i removed the «../node_modules/bootstrap/dist/css/bootstrap.min.css» from angular.json

In my case, my problem was a misspelling issue in the directory URL inside Angular.json. So I corrected the error and the apps run perfectly afterwards.

Not working: (misspelled on «node_modules»)

"styles": ["./node_moodules/font-awesome/css/font-awesome.css"]

Working:

"styles": ["./node_modules/font-awesome/css/font-awesome.css"]

try checking your url path in Angular.json, this probably the case, hopefully this helps!

I had the same problem. But I found a Solution which works for me.

Try:

npm install —save bootstrap

and then add in angular.json at «styles»:

«node_modules/bootstrap/dist/css/bootstrap.min.css»

run the Project (Watch if youre in the right folder you can check it with typing in terminal ls and and then you should see node_modules, src etc.)

ng serve

I had this problem on a non-Angular project; here’s what worked for me:

  1. update node and npm
  2. delete package-lock.json
  3. run npm install --package-lock-only

As @Manuel Villadiego said, you must define your bootstrap path like below:

«node_modules/bootstrap/dist/css/bootstrap.min.css»

Or

«./node_modules/bootstrap/dist/css/bootstrap.min.css»

This error will happen when you start bootstrap path with ../ ,

«../node_modules/bootstrap/dist/css/bootstrap.min.css»

because you go back one folder and node_modules folder doesn’t exist there.

So to sum up what is the cause of the issue. Its that the node_modules is not being read well from the angular.json file

You need to check with the path of bootstrap in angular.json inside architect then styles

I have a pipeline it used to work fine but now suddenly npm install fails. Any help on fixing this would be great 

Below is the sample of the error stack 


"npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-a10b2afc/src'

npm WARN tar ENOENT: no such file or directory, open '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/operators/zipAll.d.ts'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/src'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-d5c47b0a/_esm2015'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-a10b2afc/_esm2015'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/src'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-d5c47b0a/_esm5'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-a10b2afc/_esm5'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/src'

npm WARN tar ENOENT: no such file or directory, open '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-d5c47b0a/LICENSE.txt'

npm WARN tar ENOENT: no such file or directory, open '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-a10b2afc/LICENSE.txt'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/src'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-d5c47b0a/src'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-a10b2afc/src'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/_esm2015'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/_esm5'

npm WARN tar ENOENT: no such file or directory, open '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/LICENSE.txt'

npm WARN tar ENOENT: no such file or directory, lstat '/opt/atlassian/pipelines/agent/build/node_modules/.staging/rxjs-0d3768eb/src'"

danieldafoe

Hi there,

Currently trying to port over the organization’s Jade to Pug, but getting this error. I’m using the gulp-pug package.

Versions
Node.js: 6.2.0
npm: 3.8.9
gulp-pug: ^3.1.0

events.js:160
      throw er; // Unhandled 'error' event
      ^
SyntaxError: Unexpected token (205:0)
    at Parser.pp$4.raise (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:603:10)
    at Parser.pp$2.parseBindingAtom (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:1417:12)
    at Parser.pp$1.parseVarId (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:1049:20)
    at Parser.pp$1.parseVar (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:1032:14)
    at Parser.pp$1.parseVarStatement (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:917:10)
    at Parser.pp$1.parseStatement (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:706:19)
    at Parser.pp$1.parseTopLevel (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:638:25)
    at Parser.parse (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:516:17)
    at Object.parse (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn/dist/acorn.js:3098:39)
    at reallyParse (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn-globals/index.js:22:16)
    at findGlobals (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/acorn-globals/index.js:35:11)
    at addWith (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/node_modules/with/index.js:29:14)
    at Object.Compiler.compile (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/index.js:129:12)
    at generateCode (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug-code-gen/index.js:32:39)
    at compileBody (/Users/danieldafoe/Desktop/olb-day1/node_modules/pug/lib/index.js:170:12)

Any help would be greatly appreciated!

ForbesLindesay

Would you be interested in moving this repo into the pugjs org? Still with you maintaining it, but it might give this more visibility as the «official» gulp pug implementation.

tolson32

I’m using jade for the first time. I installed Node.js and I’m using notepadd ++ to write in jade.
I used the command prompt to install jade with:

C:Userstom>npm install jade
npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
C:Userstom
-- jade@1.11.0 +-- character-parser@1.2.1 +-- clean-css@3.4.20 | +-- commander@2.8.1 | | — graceful-readlink@1.0.1
| -- source-map@0.4.4 | — amdefine@1.0.1
+— commander@2.6.0
+— constantinople@3.0.2
| -- acorn@2.7.0 +-- jstransformer@0.0.2 | +-- is-promise@2.1.0 | — promise@6.1.0
| -- asap@1.0.0 +-- mkdirp@0.5.1 | — minimist@0.0.8
+— transformers@2.1.0
| +— css@1.0.8
| | +— css-parse@1.0.4
| | -- css-stringify@1.0.5 | +-- promise@2.0.0 | | — is-promise@1.0.1
| -- uglify-js@2.2.5 | +-- optimist@0.3.7 | | — wordwrap@0.0.3
| -- source-map@0.1.43 +-- uglify-js@2.7.4 | +-- async@0.2.10 | +-- source-map@0.5.6 | +-- uglify-to-browserify@1.0.2 | — yargs@3.10.0
| +— camelcase@1.2.1
| +— cliui@2.1.0
| | +— center-align@0.1.3
| | | +— align-text@0.1.4
| | | | +— kind-of@3.0.4
| | | | | -- is-buffer@1.1.4 | | | | +-- longest@1.0.1 | | | | — repeat-string@1.6.1
| | | -- lazy-cache@1.0.4 | | +-- right-align@0.1.3 | | — wordwrap@0.0.2
| +— decamelize@1.2.0
| -- window-size@0.1.0 +-- void-elements@2.0.1 — with@4.0.3
+— acorn@1.2.2
`— acorn-globals@1.0.9

npm WARN enoent ENOENT: no such file or directory, open ‘C:Userstompackage.json’
npm WARN tom No description
npm WARN tom No repository field.
npm WARN tom No README data
npm WARN tom No license field.

Then checked to see if it worked by: jade —help

All looks good. till I get to compiling the code to HTML.
On the command line I type: jade jadetut.jade

and it reads

C:>jade jadetut.jade

fs.js:893
return binding.lstat(pathModule._makeLong(path));
^

Error: ENOENT: no such file or directory, lstat ‘C:jadetut.jade’
at Object.fs.lstatSync (fs.js:893:18)
at renderFile (C:UserstomAppDataRoamingnpmnode_modulesjadebinjade.js:227:17)
at C:UserstomAppDataRoamingnpmnode_modulesjadebinjade.js:136:5
at Array.forEach (native)
at Object. (C:UserstomAppDataRoamingnpmnode_modulesjadebinjade.js:135:9)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)

What am I doing wrong?? The path looks like the issue but I’m a nube and don’t know what is going on…

ivanprotsko

Please, help me.

In the older version this code is working:

gulp.task('views', function buildHTML() {
return gulp.src('build//*.pug')
.pipe(watch('build//*.pug'))
.pipe(pug({ yourTemplate: 'Locals' }))
.pipe(gulp.dest('public/'))
.pipe(livereload({ start: true }));
});

yesterday I am upgrade to latest version and now getting this error:

TypeError: pug is not a function
at Gulp.buildHTML (/Users/prots/Projects/learn-javascript/gulpfile.js:43:13)
at module.exports (/Users/prots/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/prots/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/prots/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Users/prots/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:46:20
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Function.Module.runMain (module.js:577:11)
at startup (node.js:160:18)

Tell me, please, how I can fix this problem?

Tiliavir

There seems to be a major issue with the scoping of variables, that are not available for all files.

Unfortunately I’m not sure which component of pug is the root cause for this.

I have prepared a small sample here:
https://github.com/Tiliavir/pug-variable-scope-issue

Simply CO, run npm run build and check the output vs. the resulting HTML. Subtitle should be empty in most files, but are used in files where subtitle is not specified.

My output is:

PS C:pug-variable-scope-issue> npm run build

> var-issue@1.0.0 build C:pug-variable-scope-issue
> node -v && npm -v && gulp

v6.9.1
3.10.8
[10:16:53] Using gulpfile C:pug-variable-scope-issue
[10:16:53] Starting 'default'...
[10:16:53] Finished 'default' after 17 ms
1 - undefined
2 - sub2
3 - undefined
4 - undefined
5 - sub5
6 - undefined

G0lang

Hi,
I have problem with Eco: Embedded CoffeeScript templates syntax .
I think for these characters <% %>
any idea how do I fix it ?

aaronstezycki

Hi guys, a noobie question probably. So I’ve got the following gulp setup:

gulp.task('pug', function buildHTML(){
    gulp.src('src/**/*.pug')
        .pipe(pug())
        .pipe(gulp.dest('./dist/'))
});

And my folder structure looks like —>

/app
- /dist/
- /src/
- - /views
- - index.pug
- - about.pug

When I compile to the /dist/ directory I get a few unwanted folders — >
It looks like its using the home directory as the starting location for my dist files. What I really want is to compile straight into the /dist/ folder without creating another app and src folder within the dist.

/app/
-/dist/ 
- - /assets/
- - /app/
- - - /src/
- - - - index.html
- - - - about.html

What I want is …

/app/
- /dist/
- - /assets/
- - index.html
- - about.html
- /src/
- - /views/
- - index.pug

Kinda hard to explain, but its simple really. I know i might have to use gulp — rename but I’m unsure and not very experienced with gulp just yet. Any help will be appreciated.

jGleitz

Currently, the way of providing data through the stream file object and through the options cannot be combined.

However, I’d like to do exactly that. So I propose to merge the file.data with the opts.data, just like described in gulp-data.

nickdriller

I’m working with Bootstrap-JADE http://rajasegar.github.io/JADE-Bootstrap/getting-started.html i changed the extension to .pug and using gulp-pug for compiling.
For example i’ve got this mixin

mixin icon(name)
    span(class='glyphicon glyphicon-#{name}', aria-hidden='true')

this is how i’m using it

and this is how compiles

<span class="glyphicon glyphicon-#{name}" aria-hidden="true"></span>

When i change the file extensions to .jade and use gulp-jade compiles correctly. Also works in Codepen

<span aria-hidden="true" class="glyphicon glyphicon-test"></span>

I’m thinking this is a gulp-pug issue

timaschew

I have some gulp tasks, first I compiling the jade templates, then some static copy tasks are executed.

My output is this:

[09:30:58] Finished 'collection-templates' after 1.07 s
[09:30:58] Starting 'styles'...
[09:30:59] Starting 'static'...

But immediately after this line I get this error below. If I disable the colleciton-templates task the error disappears. And the error disappears also if I remove the line pipe(jadeGulp())

The other issue is that I don’t understand what’s the problem. I have no reference which line is influencing it, the part could be solved if the error would thrown synchronous or a file and line number would be provided.

events.js:141
      throw er; // Unhandled 'error' event
            ^
SyntaxError: Assigning to rvalue (5:0)
  at Parser.pp.raise (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1745:13)
  at Parser.pp.checkLVal (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:1971:12)
  at Parser.pp.parseMaybeUnary (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:999:22)
  at Parser.pp.parseExprOps (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:948:19)
  at Parser.pp.parseMaybeConditional (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:930:19)
  at Parser.pp.parseMaybeAssign (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:908:19)
  at Parser.pp.parseExpression (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:882:19)
  at Parser.pp.parseStatement (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:2461:23)
  at Parser.pp.parseTopLevel (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:2379:21)
  at Object.parse (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn/dist/acorn.js:101:12)
  at reallyParse (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn-globals/index.js:46:20)
  at findGlobals (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/node_modules/acorn-globals/index.js:58:11)
  at addWith (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/node_modules/with/index.js:45:14)
  at parse (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/lib/index.js:149:9)
  at Object.exports.compile (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/jade/lib/index.js:205:16)
  at DestroyableTransform.CompileJade [as _transform] (/Users/awilhelm/website/node_modules/gulp-jade/index.js:34:27)
  at DestroyableTransform.Transform._read (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
  at DestroyableTransform.Transform._write (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
  at doWrite (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
  at writeOrBuffer (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
  at DestroyableTransform.Writable.write (/Users/awilhelm/website/node_modules/gulp-jade/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
  at write (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
  at flow (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
  at DestroyableTransform.pipeOnReadable (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
  at emitNone (events.js:67:13)
  at DestroyableTransform.emit (events.js:163:7)
  at emitReadable_ (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
  at emitReadable (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
  at readableAddChunk (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
  at DestroyableTransform.Readable.push (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
  at DestroyableTransform.Transform.push (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
  at afterTransform (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
  at TransformState.afterTransform (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
  at DestroyableTransform.noop [as _transform] (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/through2.js:26:3)
  at DestroyableTransform.Transform._read (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
  at DestroyableTransform.Transform._write (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
  at doWrite (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
  at writeOrBuffer (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
  at DestroyableTransform.Writable.write (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
  at write (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
  at flow (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
  at DestroyableTransform.pipeOnReadable (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
  at emitNone (events.js:67:13)
  at DestroyableTransform.emit (events.js:163:7)
  at emitReadable_ (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
  at emitReadable (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
  at readableAddChunk (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
  at DestroyableTransform.Readable.push (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
  at DestroyableTransform.Transform.push (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
  at afterTransform (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
  at TransformState.afterTransform (/Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
  at /Users/awilhelm/website/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js:12:5
  at FSReqWrap.readFileAfterClose [as oncomplete] (evalmachine.<anonymous>:382:3)

3ilguun

Is there any option? I have lots of templates. Everytime when i change my template compiles all files start to finish.

sntiagomoreno

Pug gets compiled fine, but an error is being thrown each time it runs the task:

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: /Users/Santiago/Documents/Correos/node_modules/pug-filters/test/cases/filters.include.custom.pug:4

unknown filter ":custom"
    at makeError (/Users/Santiago/Documents/Correos/node_modules/pug-error/index.js:32:13)
    at filterWithFallback (/Users/Santiago/Documents/Correos/node_modules/pug-filters/lib/handle-filters.js:52:17)
    at filterFileWithFallback (/Users/Santiago/Documents/Correos/node_modules/pug-filters/lib/handle-filters.js:62:16)
    at walk.includeDependencies (/Users/Santiago/Documents/Correos/node_modules/pug-filters/lib/handle-filters.js:33:18)
    at walkAST (/Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:13:26)
    at /Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:21:16
    at Array.map (native)
    at walkAST (/Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:20:29)
    at walkAST (/Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:33:21)
    at /Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:21:16
    at Array.map (native)
    at walkAST (/Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:20:29)
    at walkAST (/Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:33:21)
    at /Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:21:16
    at Array.map (native)
    at walkAST (/Users/Santiago/Documents/Correos/node_modules/pug-walk/index.js:20:29)

edwardessing

Hey, currently getting this error:

Plumber found unhandled error: RangeError in plugin 'gulp-pug' Message: Maximum call stack size exceeded Details: undefined: true

Here are my current dependencies:
"devDependencies": { "browser-sync": "^2.14.0", "gulp": "^3.9.1", "gulp-autoprefixer": "^3.1.0", "gulp-changed": "^1.3.1", "gulp-concat": "^2.6.0", "gulp-jshint": "^2.0.1", "gulp-plumber": "^1.1.0", "gulp-pug": "^3.0.3", "gulp-sass": "^2.3.2", "gulp-uglify": "^1.5.4", "jshint": "^2.9.2" }

TimothyGu

This way users can prevent downloading two copies of Pug (one bundled with gulp-pug, the other their own). This is especially important as Pug currently hasn’t released a stable version, so bug fixes are fast in coming.

jamen

When a stable version of pug is released (as v2) I should update it in the dependencies. Right now everything is either prereleased or deprecated, so I’m just going to leave it until then.

Consider using opts.pug if you need the latest prereleased version.

chippawah

I don’t know what happened but pug 1.3.1 isn’t available from npm and gulp-pug throws a non zero exit code because of it.
screen shot 2016-06-17 at 11 05 43 am

davidxcarroll

My current pug and watch:

// PUG

var pug = require('gulp-pug');

gulp.task('pug', function() {
  gulp.src('./src/**/*.pug')
  .pipe(pug({
    pretty: true
  }))
  .pipe(pug().on('error', pug.logError))
  .pipe(gulp.dest('./public'))
});

// WATCH

gulp.task('watch', function() {
  gulp.watch(['./src/**/*.pug'], ['pug']),
  gulp.watch(['./src/sass/**/*.scss'],['sass']);
});

I’m assuming this line could be improved? And/or relocated?
.pipe(pug().on('error', pug.logError))

Thanks in advance! And sorry, I tried doing research before posting but couldn’t find something I could implement. I’m pretty new to Gulp and Pug.

ingevlaar

I use Pug in two ways. For development I run Express and Pug as view engine and for distribution I use gulp-pug. Works perfectly fine till today.

I tried to run gulp-pug on a file which includes the following concept:

- var partialData = [{title: "Partial 1"}, {title: "Partial 2"}];

each item in partialData
    span=item.title
    include ../partials/partial

and partials/partial.pug includes only:

Works perfectly fine in development, but fails with gulp-pug

events.js:160
      throw er; // Unhandled 'error' event
      ^
 TypeError: C:D-drive_vspBoilerplate-Frontenddevhtmlcomponentspartialspa
rtial.pug:1
  > 1| span=item.title

Cannot read property 'title' of undefined
    at eval (eval at wrap (C:D-drive_vspBoilerplate-Frontenddevnode_modules
pug-runtimewrap.js:6:10), <anonymous>:7:61)
    at template (eval at wrap (C:D-drive_vspBoilerplate-Frontenddevnode_mod
ulespug-runtimewrap.js:6:10), <anonymous>:7:118)
    at DestroyableTransform.compilePug (C:D-drive_vspBoilerplate-Frontenddev
node_modulesgulp-pugindex.js:33:49)
    at DestroyableTransform.Transform._read (C:D-drive_vspBoilerplate-Fronten
ddevnode_modulesreadable-streamlib_stream_transform.js:159:10)
    at DestroyableTransform.Transform._write (C:D-drive_vspBoilerplate-Fronte
nddevnode_modulesreadable-streamlib_stream_transform.js:147:83)
    at doWrite (C:D-drive_vspBoilerplate-Frontenddevnode_modulesreadable-s
treamlib_stream_writable.js:313:64)
    at writeOrBuffer (C:D-drive_vspBoilerplate-Frontenddevnode_modulesread
able-streamlib_stream_writable.js:302:5)
    at DestroyableTransform.Writable.write (C:D-drive_vspBoilerplate-Frontend
devnode_modulesreadable-streamlib_stream_writable.js:241:11)
    at write (C:D-drive_vspBoilerplate-Frontenddevnode_modulesvinyl-fsnod
e_modulesreadable-streamlib_stream_readable.js:623:24)
    at flow (C:D-drive_vspBoilerplate-Frontenddevnode_modulesvinyl-fsnode
_modulesreadable-streamlib_stream_readable.js:632:7)

I hope someone can help me out.

ceremcem

Following mixin does not work:

mixin test(aaa)
    != '<script>'
    block <- there is a whitespace here
    != '</script>'

However following mixin works:

mixin test(aaa)
    != '<script>'
    block<- there is no whitespace after `block`
    != '</script>'

DinisCruz

I just started having this error (see full stacktrace below)

looks like it is happening in the pug-linker module. Any ideas of what is the problem?

for reference here is how I’m using it

gulp.task 'compile-pug', ()->
  gulp.src pug_Files
      #.pipe plumber()
      .pipe pug()
      .pipe gulp.dest html_Folder
MacBook-Pro-2:ui diniscruz$ gulp compile-pug
[11:36:06] Requiring external module coffee-script/register
[11:36:07] Using gulpfile ~/GitHub_REPOS/Maturity-Models/ui/gulpfile.coffee
[11:36:07] Starting 'compile-pug'...

events.js:141
      throw er; // Unhandled 'error' event
      ^
TypeError: Cannot read property 'type' of undefined
  at link (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-linker/index.js:12:13)
  at after (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-linker/index.js:110:26)
  at walkAST (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:78:12)
  at /Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:21:16
  at Array.map (native)
  at walkAST (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:20:29)
  at walkAST (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:33:21)
  at /Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:21:16
  at Array.map (native)
  at walkAST (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:20:29)
  at walkAST (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:33:21)
  at /Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:21:16
  at Array.map (native)
  at walkAST (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-walk/index.js:20:29)
  at applyIncludes (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-linker/index.js:104:10)
  at link (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug-linker/index.js:21:9)
  at compileBody (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug/lib/index.js:134:9)
  at Object.exports.compile (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/pug/lib/index.js:206:16)
  at DestroyableTransform.compilePug (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/gulp-pug/index.js:33:26)
  at DestroyableTransform.Transform._read (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
  at DestroyableTransform.Transform._write (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
  at doWrite (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)
  at writeOrBuffer (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)
  at DestroyableTransform.Writable.write (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)
  at write (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
  at flow (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
  at DestroyableTransform.pipeOnReadable (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
  at emitNone (events.js:67:13)
  at DestroyableTransform.emit (events.js:166:7)
  at emitReadable_ (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:448:10)
  at emitReadable (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:444:5)
  at readableAddChunk (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:187:9)
  at DestroyableTransform.Readable.push (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:149:10)
  at DestroyableTransform.Transform.push (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:145:32)
  at afterTransform (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:101:12)
  at TransformState.afterTransform (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:79:12)
  at DestroyableTransform.noop [as _transform] (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/through2/through2.js:26:3)
  at DestroyableTransform.Transform._read (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:184:10)
  at DestroyableTransform.Transform._write (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:172:12)
  at doWrite (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_writable.js:237:10)
  at writeOrBuffer (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_writable.js:227:5)
  at DestroyableTransform.Writable.write (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_writable.js:194:11)
  at write (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
  at flow (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
  at DestroyableTransform.pipeOnReadable (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
  at emitNone (events.js:67:13)
  at DestroyableTransform.emit (events.js:166:7)
  at emitReadable_ (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:448:10)
  at emitReadable (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:444:5)
  at readableAddChunk (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:187:9)
  at DestroyableTransform.Readable.push (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:149:10)
  at DestroyableTransform.Transform.push (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:145:32)
  at afterTransform (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:101:12)
  at TransformState.afterTransform (/Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_transform.js:79:12)
  at /Users/diniscruz/GitHub_REPOS/Maturity-Models/ui/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js:12:5
  at FSReqWrap.readFileAfterClose [as oncomplete] (evalmachine.<anonymous>:404:3)

Nodejs Error: ENOENT: no such file or directory

This tutorial guides you on how to fix Nodejs Error: ENOENT: no such file or directory while running your node project or any application which contains Nodejs component.

Nodejs Error: ENOENT: no such file or directory

When I tried to download guacamole-client whose frontend is developed using Nodejs, and I tried to setup installing guacamole natively on Windows machine.

After downloading the code, I was trying to build guacamole-client which includes Nodejs frontend component by running “mvn package” command as shown below. But it resulted with error “Error: ENOENT: no such file or directory, open ‘C:UsersDocumentsWorkguacamole-client-masterguacamolesrcmainfrontenddistnpm-dependencies.txt’

> mvn package
---
---
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptextInputdirectivesguacKey.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptextInputdirectivesguacTextInput.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptextInputstylestextInput.css" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptextInputtextInputModule.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptouchdirectivesguacTouchDrag.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptouchdirectivesguacTouchPinch.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcapptouchtouchModule.js" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcindex.html" (no NPM package)
[INFO] <i> [dependency-list-plugin] Skipping file dependency "srcrelocateParameters.js" (no NPM package)
[INFO] [webpack-cli] Error: ENOENT: no such file or directory, open 'C:UsersDocumentsWorkguacamole-client-masterguacamolesrcmainfrontenddistnpm-dependencies.txt'
[INFO]     at Object.openSync (fs.js:476:3)
[INFO]     at Object.writeFileSync (fs.js:1467:35)
----
[INFO]     at AsyncSeriesHook.lazyCompileHook (C:UsersDocumentsWorkguacamole-client-masterguacamolesrcmainfrontendnode_modulestapablelibHook.js:154:20)
[INFO]     at C:UsersDocumentsWorkguacamole-client-masterguacamolesrcmainfrontendnode_moduleswebpacklibCompilation.js:1414:32 {
[INFO]   errno: -4058,
[INFO]   syscall: 'open',
[INFO]   code: 'ENOENT',
[INFO]   path: 'C:\Users\Documents\Work\guacamole-client-master\guacamole\src\main\frontend\dist\npm-dependencies.txt'
[INFO] }
[INFO] npm ERR! code ELIFECYCLE
[INFO] npm ERR! errno 2
[INFO] npm ERR! @ build: `webpack --progress`
[INFO] npm ERR! Exit status 2
[INFO] npm ERR!
[INFO] npm ERR! Failed at the @ build script.
[INFO] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[INFO]
[INFO] npm ERR! A complete log of this run can be found in:
[INFO] npm ERR!     C:UsersAppDataRoamingnpm-cache_logs21-07-28T14_42_52_884Z-debug.log

The above command “mvn package” is supposed to invoke maven to automatically build and package all the components, producing a single .war file. And while building frontend Nodejs component, it was looking for a file called “npm-depedencies.txt” but that file is missing.

Solution

As you can see from the above error, that it is expecting file called “npm-dependencies.txt” to be there in specific path. But it does not exist.

code: 'ENOENT',

path: 'C:\Users\Documents\Work\guacamole-client-master\guacamole\src\main\frontend\dist\npm-dependencies.txt'

ENOENT means Error NO ENTry (or Error NO ENTity) or simply you can say that there is NO such directory ENTry.

Therefore, you either need to create the expected file in the specific path i.e., under dist directory or else reconfigure your application so that it will point to the correct directory path for the required file.

After fixing, try building your application again. The Nodejs Error: ENOENT: no such file or directory should have gone away now.

Hope it helped 🙂

Also see:

  • Call ngOnInit() again from another function – Angular 9 ?
  • ngOnChanges get new value and previous value – Angular
  • Global Angular CLI version is greater than your local version
  • Upgrade Angular CLI to the latest version Angular 9 or 10 ?
  • How to use new static option in ViewChild Angular 9 ?
  • Project contents into angular components using ng-content
  • Call ngOnInit() again from another function – Angular 9 ?
  • ngAfterContentInit with Example – Angular
  • make npm install command to work behind proxy ?
  • Node Sass could not find a binding for your current environment
  • ngOnDestroy Example Angular
  • Angular Component : In which lifecycle hook you can check value of DOM element ?
  • @ContentChild TypeError: Cannot read property ‘nativeElement’ of undefined
  • Access ng-content with @ContentChild – Angular Component
  • How to select an element in a component template – Angular ?
  • Difference between @ViewChild and @ContentChild – Angular Example
  • Expected 0 type arguments, but got 1 : Angular
  • Angular – Access template reference variables from component class ?
  • Pass variable from parent to custom child component – Angular 9
  • Uninstall Nodejs completely from Mac OSX ?
  • EventEmitter parameter value undefined for listener
  • Typescript Error: Property does not exist on value of type
  • Remove http and https proxy settings of npm and git ?
  • How to change node version using nvm ?

References:

  • github nvm
  • nodejs docs

#html #node.js #express #heroku

Вопрос:

Я развернул index.html страницу с помощью Node.JS in Heroku . Это файловая структура, которой я следую в Heroku

 -- Index.js
 -- public
     -- css
          -- index.css
     -- JS
          -- index.js
     -- index.html
     -- home.html
 -- procfile
 -- package.json
 

В серверном скрипте index.js

 //express
const express = require('express');
const app = express();
const PORT = process.env.PORT || 5000
const path = require('path')


app.get('/', function (req, res) {
    console.log("Current directory:", __dirname);
    console.log("filename: ", __filename);
  
    //serve the html page
    res.sendFile(path.join(__dirname, '/public/index.html'));
  });

app.listen(PORT, () => {
    console.log(`Listening on ${PORT}`);
  }); 
 

После развертывания кода и запуска server.js файл , я получаю ошибку ниже

 Error: ENOENT: no such file or directory, stat '/app/public/index.html'
 

Я не понимаю, почему возникает эта ошибка. У меня есть index.html файл в public папке.

Поэтому, чтобы понять путь к героку, я добавил следующие строки в server.js файл

 console.log("Current directory:", __dirname); // return the path
console.log("filename: ", __filename); // return the index.js file path
 

и соответствующий вывод выглядит следующим образом:

 Current directory: /app
filename:  /app/index.js
 

Теперь /app это основной каталог приложения. Так почему res.sendFile(path.join(__dirname, '/public/index.html')); же тогда возвращается то error no such file or directory, stat '/app/public/index.html' ?

Также я пробовал express.static метод в server.js подобных

 app.use(express.static(__dirname   '/public'));

app.get('/', function (req, res) {
   res.sendFile('index.html');
 });
 

затем я получил новую ошибку

 TypeError: path must be absolute or specify root to res.sendFile
 

После этого я попробовал еще один метод

 app.use(express.static(__dirname   '/public'));

app.get('/', function (req, res) {
    res.sendFile('public/index.html', { root: __dirname });
});
 

Затем я получил ту же ошибку Error: ENOENT: no such file or directory, stat '/app/public/index.html'

Есть какие-нибудь предложения? Как получить доступ index.html и home.html что я здесь делаю не так ?

Ответ №1:

Попробуйте использовать:

 res.sendFile(path.join(__dirname, 'public', 'index.html'));
 

Комментарии:

1. получение ошибки sam Error: ENOENT: no such file or directory, stat '/app/public/index.html'

Понравилась статья? Поделить с друзьями:
  • Error english cover
  • Error endl was not declared in this scope
  • Error end1 was not declared in this scope
  • Error end of file expected line
  • Error end of centdir 64 signature not where expected prepended bytes