Your gulpfile is wayyy too deep and your node_modules are way too high up the tree. node only looks up a few directories for node_modules before saying it couldn’t find it. Look at the npm/node docs for more info, but it needs to be closer.
I don’t think it’s true.
$ pwd /tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/4/3/2/1/0 $ ls gulpfile.js $ strace -e file gulp |& grep gulp.js readlink("/srv/pyramid/smms-client-nosite/lib/node_modules/.bin/gulp", "../gulp/bin/gulp.js", 4096) = 19 lstat("/srv/pyramid/smms-client-nosite/lib/node_modules/gulp/bin/gulp.js", {st_mode=S_IFREG|0755, st_size=5384, ...}) = 0 open("/srv/pyramid/smms-client-nosite/lib/node_modules/gulp/bin/gulp.js", O_RDONLY|O_CLOEXEC) = 9 stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/4/3/2/1/0/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/4/3/2/1/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/4/3/2/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/4/3/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/4/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/5/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/6/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/7/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/8/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/9/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/10/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/11/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/12/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/13/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/14/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/15/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/dir-test/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/tmp/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory) stat("/node_modules/gulp.js", 0x7ffc49012d20) = -1 ENOENT (No such file or directory)
I get the same result for 100 subdirectories.
Don’t you think it’s a security risk to search for node_modules
in upper directories (infinite or arbitrary number of levels)?
Error: Cannot find module ‘gulp’ #1135
Comments
I have problem with gulp + gulpfile as symlink 🙁
So let`s check modules:
In gulpfile.js on row 13: var gulp = require(‘gulp’);
I don`t understand where is the problem. 🙁
Maybe anyone can see some problem that i don`t see. ?!
The text was updated successfully, but these errors were encountered:
Have you globally installed it too?
Your gulpfile is wayyy too deep and your node_modules are way too high up the tree. node only looks up a few directories for node_modules before saying it couldn’t find it. Look at the npm/node docs for more info, but it needs to be closer.
Oh, i understand what you mean. You are wright. Thanks a loooot!
Your gulpfile is wayyy too deep and your node_modules are way too high up the tree. node only looks up a few directories for node_modules before saying it couldn’t find it. Look at the npm/node docs for more info, but it needs to be closer.
I don’t think it’s true.
I get the same result for 100 subdirectories.
Don’t you think it’s a security risk to search for node_modules in upper directories (infinite or arbitrary number of levels)?
@wodny This is behavior in node, not something that we did — if you feel like this is a problem you should open an issue with the node.js team about it
@contra I see. Thank you for the information.
I am learning about gulp and trying to follow some instructions on how to get gulpfile to read, instead of no file found. I am currently getting this error:
C:devvstda>gulp
module.js:457
throw err;
^
Error: Cannot find module ‘gulpfile.js’
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments
I don’t understand where the problem is coming from?
Re-installing at a higher level worked for me. I’m not sure which was important to run, but I ran both $sudo npm install -g gulp@latest and $sudo npm install -g npm@latest, then $ionic serve finally stopped saying that gulp module was missing.
It seem is npm’s problem.I couldn’t find the file in the dictionary of gulp.But I want to know how to solve this problem.Install the latest gulp version?
I tried «npm update» command and it worked
Hi, i had the same problem only i was trying to use gulp awtch and it couldnt finde the moduels. Luckuly i fixed it.
My problem for this was that i had multiple files with the name gulp, so when i tried to use gulp watch this happened:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module ‘gulp-cli’
Require stack:
- /usr/share/nodejs/gulp/bin/gulp.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/usr/share/nodejs/gulp/bin/gulp.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) <
code: ‘MODULE_NOT_FOUND’,
requireStack: [ ‘/usr/share/nodejs/gulp/bin/gulp.js’ ]
>
when i used the «npm install —global gulp-cli» command in the terminal it showed me errors that sed that i all ready have files called gulp and told me all of the locations of the, so i deleted all of them and then ran the command again npm install —global gulp-cli and it works now. I hope this helps somebody.
Источник
jarvisweb
Здравствуйте, не подскажете, в чем может быть проблема?
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp$ gulp
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'gulp-cli'
Require stack:
- /usr/share/nodejs/gulp/bin/gulp.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
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.<anonymous> (/usr/share/nodejs/gulp/bin/gulp.js:3:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/share/nodejs/gulp/bin/gulp.js' ]
}
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp$ npx gulp --version
CLI version: 2.3.0
Local version: 4.0.2
2
0
jarvisweb
Проблему решил. Возможно забыл сделать шаг npm init
или еще какой. Решил так, во многом благодаря документации gulp — quick start:
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp$ cd
jarvis@jarvis-OMEN-by-HP-Laptop:~$ npx gulp --version
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'gulp-cli'
Require stack:
- /usr/share/nodejs/gulp/bin/gulp.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
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.<anonymous> (/usr/share/nodejs/gulp/bin/gulp.js:3:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/share/nodejs/gulp/bin/gulp.js' ]
}
jarvis@jarvis-OMEN-by-HP-Laptop:~$ node --version
v16.13.2
jarvis@jarvis-OMEN-by-HP-Laptop:~$ npm --version
8.4.0
jarvis@jarvis-OMEN-by-HP-Laptop:~$ npx --version
8.4.0
jarvis@jarvis-OMEN-by-HP-Laptop:~$ sudo npm install --global gulp-cli
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! code EEXIST
npm ERR! path /usr/bin/gulp
npm ERR! EEXIST: file already exists
npm ERR! File exists: /usr/bin/gulp
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-08T13_20_59_161Z-debug-0.log
jarvis@jarvis-OMEN-by-HP-Laptop:~$ sudo npm install --global gulp-cli --force
npm WARN using --force Recommended protections disabled.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
added 266 packages, and audited 267 packages in 2s
7 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
jarvis@jarvis-OMEN-by-HP-Laptop:~$ gulp --version
CLI version: 2.3.0
Local version: Unknown
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop$ npx mkdirp hexlet-gulp-project
Need to install the following packages:
mkdirp
Ok to proceed? (y) y
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp-project$ npm init
This utility will walk you through creating a package.json file....
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp-project$ npm install --save-dev gulp
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
added 349 packages, and audited 350 packages in 7s
8 packages are looking for funding
run `npm fund` for details
6 high severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp-project$ gulp --version
CLI version: 2.3.0
Local version: 4.0.2
jarvis@jarvis-OMEN-by-HP-Laptop:~/Desktop/hexlet-gulp-project$ touch gulpfile.js
0
Nikita Mikhaylov
Здравствуйте
Скорее всего изначально вы его поставили не глобально, а с помощью флага --save-dev
. В таком случае запуск стоит делать через команду npx gulp
. Если вы его поставили потом глобально, то да, уже можно будет использовать просто команду gulp
, так как она теперь записана в переменной $PATH
1
AlexKOR5 50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
||||
1 |
||||
19.01.2021, 19:57. Показов 13360. Ответов 87 Метки нет (Все метки)
Здравствуйте, когда я пытаюсь запустить любую команду в gulp, консоль выдает мне ошибку: Код C:ShopMakingWorkDjango_shop>gulp internal/modules/cjs/loader.js:965 throw err; ^ Error: Cannot find module './lib/_stream_readable.js' Require stack: - C:ShopMakingWorkDjango_shopnode_modulesreadable-streamreadable.js - C:ShopMakingWorkDjango_shopnode_modulesordered-read-streamsindex.js - C:ShopMakingWorkDjango_shopnode_modulesglob-streamindex.js - C:ShopMakingWorkDjango_shopnode_modulesvinyl-fslibsrcindex.js - C:ShopMakingWorkDjango_shopnode_modulesvinyl-fsindex.js - C:ShopMakingWorkDjango_shopnode_modulesgulpindex.js - C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clilibversioned^4.0.0index.js - C:UsersAdminAppDataRoamingnpmnode_modulesgulp-cliindex.js - C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:1022:19)←[39m ←[90m at require (internal/modules/cjs/helpers.js:72:18)←[39m at Object.<anonymous> (C:ShopMakingWorkDjango_shopnode_modules←[4mreadable-stream←[24mreadable.js:12:30) ←[90m at Module._compile (internal/modules/cjs/loader.js:1118:30)←[39m ←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)←[39m ←[90m at Module.load (internal/modules/cjs/loader.js:982:32)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:875:14)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:1022:19)←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [ ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\readabl e-stream\readable.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\ordered-read-streams\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\glob-stream\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\vinyl-fs\lib\src\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\vinyl-fs\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\gulp\i ndex.js'←[39m, ←[32m'C:\Users\Admin\AppData\Roaming\npm\node_modules\g ulp-cli\lib\versioned\^4.0.0\index.js'←[39m, ←[32m'C:\Users\Admin\AppData\Roaming\npm\node_modules\g ulp-cli\index.js'←[39m, ←[32m'C:\Users\Admin\AppData\Roaming\npm\node_modules\g ulp-cli\bin\gulp.js'←[39m ] } Не знаю как это устранить.
__________________
0 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
21.01.2021, 23:00 [ТС] |
61 |
хотя мы его уже ставили Код C:ShopMakingWorkDjango_shop>npm i gulp npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN rm not removing C:ShopMakingWorkDjango_shopnode_modules.bingulp.ps1 as it wasn't installed by C:ShopMakingWorkDjango_shopnode_modulesgulp npm WARN rm not removing C:ShopMakingWorkDjango_shopnode_modules.bingulp.cmd as it wasn't installed by C:ShopMakingWorkDjango_shopnode_modulesgulp npm WARN rm not removing C:ShopMakingWorkDjango_shopnode_modules.bingulp as it wasn't installed by C:ShopMakingWorkDjango_shopnode_modulesgulp npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_moduleschokidarnode_modulesfsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + gulp@4.0.2 removed 6 packages, updated 2 packages, moved 2 packages and audited 494 packages in 7.675s 9 packages are looking for funding run `npm fund` for details found 0 vulnerabilities C:ShopMakingWorkDjango_shop>gulp internal/modules/cjs/loader.js:965 throw err; ^ Error: Cannot find module 'C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js' ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m ←[90m at internal/main/run_main_module.js:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }
__________________
0 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
21.01.2021, 23:01 |
62 |
1 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
21.01.2021, 23:02 [ТС] |
63 |
Сделал
0 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
21.01.2021, 23:03 |
64 |
теперь gulp в проекте запускайте
1 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
21.01.2021, 23:05 [ТС] |
65 |
теперь gulp в проекте запускайте Код C:ShopMakingWorkDjango_shop>npm uninstall gulp -g up to date in 0.085s C:ShopMakingWorkDjango_shop>gulp internal/modules/cjs/loader.js:965 throw err; ^ Error: Cannot find module 'C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js' ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m ←[90m at internal/main/run_main_module.js:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }
0 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
21.01.2021, 23:08 [ТС] |
66 |
у меня нет же этой папки и файла (node_modulesgulp-clibingulp.js) Миниатюры
0 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
21.01.2021, 23:10 |
67 |
не поможет это я уже фантазирую
2 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
21.01.2021, 23:19 [ТС] |
68 |
не поможет это я уже фантазирую
Код C:ShopMakingWorkDjango_shop>npm uninstall gulp-cli -g up to date in 0.088s C:ShopMakingWorkDjango_shop>npm install gulp-cli -g npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN rollback Rolling back is-descriptor@1.0.2 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clinode_modulessnapdragon-nodenode_modules' npm ERR! code EEXIST npm ERR! path C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js npm ERR! dest C:UsersAdminAppDataRoamingnpmgulp npm ERR! EEXIST: file already exists, cmd shim 'C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js' -> 'C:UsersAdminAppDataRoamingnpmgulp' npm ERR! File exists: C:UsersAdminAppDataRoamingnpmgulp npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. npm ERR! A complete log of this run can be found in: npm ERR! C:UsersAdminAppDataRoamingnpm-cache_logs2021-01-21T20_16_42_760Z-debug.log C:ShopMakingWorkDjango_shop>npm cache clean --force npm WARN using --force I sure hope you know what you are doing. C:ShopMakingWorkDjango_shop>npm install gulp-cli -g npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm ERR! code EEXIST npm ERR! path C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js npm ERR! dest C:UsersAdminAppDataRoamingnpmgulp npm ERR! EEXIST: file already exists, cmd shim 'C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js' -> 'C:UsersAdminAppDataRoamingnpmgulp' npm ERR! File exists: C:UsersAdminAppDataRoamingnpmgulp npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. npm ERR! A complete log of this run can be found in: npm ERR! C:UsersAdminAppDataRoamingnpm-cache_logs2021-01-21T20_18_16_919Z-debug.log C:ShopMakingWorkDjango_shop>gulp internal/modules/cjs/loader.js:965 throw err; ^ Error: Cannot find module 'C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js' ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m ←[90m at internal/main/run_main_module.js:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }
0 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
21.01.2021, 23:21 |
69 |
Код npm i gulp @babel/core @babel/preset-env gulp-concat gulp-babel gulp-uglify gulp-plumber --save-dev эту строку нужно было выполнять с суффиксом —save-dev но у меня и так и так работает
1 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
21.01.2021, 23:23 [ТС] |
70 |
Я нашел папку которую требовал gulp Код C:ShopMakingWorkDjango_shop>gulp internal/modules/cjs/loader.js:965 throw err; ^ Error: Cannot find module './lib/source-map-generator' Require stack: - C:ShopMakingWorkDjango_shopnode_modulessource-mapsource-map.js - C:ShopMakingWorkDjango_shopnode_modulessnapdragonlibutils.js - C:ShopMakingWorkDjango_shopnode_modulessnapdragonlibcompiler.js - C:ShopMakingWorkDjango_shopnode_modulessnapdragonindex.js - C:ShopMakingWorkDjango_shopnode_modulesbraceslibbraces.js - C:ShopMakingWorkDjango_shopnode_modulesbracesindex.js - C:ShopMakingWorkDjango_shopnode_modulesmicromatchindex.js - C:ShopMakingWorkDjango_shopnode_modulesanymatchindex.js - C:ShopMakingWorkDjango_shopnode_moduleschokidarindex.js - C:ShopMakingWorkDjango_shopnode_modulesglob-watcherindex.js - C:ShopMakingWorkDjango_shopnode_modulesgulpindex.js - C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clilibversioned^4.0.0index.js - C:UsersAdminAppDataRoamingnpmnode_modulesgulp-cliindex.js - C:UsersAdminAppDataRoamingnpmnode_modulesgulp-clibingulp.js ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:1022:19)←[39m ←[90m at require (internal/modules/cjs/helpers.js:72:18)←[39m at Object.<anonymous> (C:ShopMakingWorkDjango_shopnode_modules←[4msource-map←[24msource-map.js:6:30) ←[90m at Module._compile (internal/modules/cjs/loader.js:1118:30)←[39m ←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)←[39m ←[90m at Module.load (internal/modules/cjs/loader.js:982:32)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:875:14)←[39m ←[90m at Module.require (internal/modules/cjs/loader.js:1022:19)←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [ ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\source-map\source-map.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\snapdragon\lib\utils.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\snapdragon\lib\compiler.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\snapdragon\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\braces\lib\braces.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\braces\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\micromatch\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\anymatch\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\chokidar\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\glob-watcher\index.js'←[39m, ←[32m'C:\ShopMaking\Work\Django_shop\node_modules\gulp\index.js'←[39m, ←[32m'C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js'←[39m, ←[32m'C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp-cli\index.js'←[39m, ←[32m'C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js'←[39m ] } Миниатюры
0 |
web_coder2 748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
||||
21.01.2021, 23:31 |
71 |
|||
Решениепотому что инсталл и клиин не сработали я думаю пришло время сносить node и ставить заново как описано тут https://stackoverflow.com/ques… om-windows Добавлено через 5 минут
удаляем node_modules package-lock.json package.json в проекте создаем package.json
запускаем
3 |
AlexKOR5 50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
||||
21.01.2021, 23:41 [ТС] |
72 |
|||
потому что инсталл и клиин не сработали я думаю пришло время сносить node и ставить заново как описано тут https://stackoverflow.com/ques… om-windows Добавлено через 5 минут
удаляем node_modules package-lock.json package.json в проекте создаем package.json
запускаем Тут я не понял Миниатюры
0 |
AlexKOR5 50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
||||
21.01.2021, 23:51 [ТС] |
73 |
|||
потому что инсталл и клиин не сработали я думаю пришло время сносить node и ставить заново как описано тут https://stackoverflow.com/ques… om-windows Добавлено через 5 минут
удаляем node_modules package-lock.json package.json в проекте создаем package.json
запускаем После переустановки я сделал npm install gulp-cli -g но консоль пишет Код C:ShopMakingWorkDjango_shop>npm install gulp-cli -g "npm" не является внутренней или внешней командой, исполняемой программой или пакетным файлом.
0 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
22.01.2021, 00:00 |
74 |
После переустановки я сделал npm install gulp-cli -g но консоль пишет вы успели всю инструкцию сделать ? =) А обратно node установить? Добавлено через 27 секунд Добавлено через 43 секунды
вы успели всю инструкцию сделать ? =) все папки вручную по удаляли? да?
1 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
22.01.2021, 00:01 [ТС] |
75 |
вы успели всю инструкцию сделать ? =) А обратно node установить? Добавлено через 27 секунд Добавлено через 43 секунды все папки вручную по удаляли? да? Я в курсе, я установил ноду снова и все равно консоль пишет это.
0 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
22.01.2021, 00:07 |
76 |
Я в курсе, я установил ноду снова и все равно консоль пишет это там наверняка при установке надо было где то галочку поставить прописать заново пути =) Но это не страшно наверное =) C:Usersuser>where npm добавьте(там уже будет что то в конец той строки через точку с запятой добавьте путь C:Program Filesnodejs) в системную переменную PATH путь до этой папки если у Вас также
2 |
748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
|
22.01.2021, 00:11 |
77 |
картинки Миниатюры
2 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
22.01.2021, 12:24 [ТС] |
78 |
После переустановки я сделал npm install gulp-cli -g но консоль пишет Код C:ShopMakingWorkDjango_shop>npm install gulp-cli -g "npm" не является внутренней или внешней командой, исполняемой программой или пакетным файлом. Заработало! Код C:ShopMakingWorkDjango_shop>gulp [11:15:11] Using gulpfile C:ShopMakingWorkDjango_shopgulpfile.js [11:15:11] Starting 'default'... [11:15:11] Starting 'scripts'... [11:15:12] Finished 'scripts' after 15 ms [11:15:12] Finished 'default' after 18 ms package.json Код { "name": "1", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "@babel/core": "^7.12.10", "@babel/preset-env": "^7.12.11", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", "gulp-concat": "^2.6.1", "gulp-plumber": "^1.2.1", "gulp-uglify": "^3.0.2" } } gulpfile.js Код const gulp = require("gulp"); const { parallel, series } = require("gulp"); const concat = require("gulp-concat"); const babel = require('gulp-babel'); const uglify = require("gulp-uglify"); var plumber = require('gulp-plumber'); function scripts(cb) { gulp.src([ 'app/static/js/poppingDownHints.js', 'app/static/js/link_to_Search.js', 'app/static/js/product_catalog_btn.js', 'app/static/js/script_1.js' ]) .pipe(concat('mainBase.min.js')) .pipe(plumber()) .pipe(babel({ presets: ['@babel/preset-env'] })) .pipe(uglify()) .pipe(gulp.dest('app/static/js/minimizing')); cb(); } exports.default = parallel( scripts ); Но появилась вторая проблема Код const gulp = require("gulp"); const { parallel, series } = require("gulp"); const concat = require("gulp-concat"); const babel = require('gulp-babel'); const uglify = require("gulp-uglify"); var plumber = require('gulp-plumber'); function scripts(cb) { gulp.src([ 'app/static/js/poppingDownHints.js', 'app/static/js/link_to_Search.js', 'app/static/js/product_catalog_btn.js', 'app/static/js/script_1.js' ]) .pipe(concat('mainBase.min.js')) .pipe(plumber()) .pipe(babel({ presets: ['@babel/preset-env'] })) .pipe(uglify()) .pipe(gulp.dest('app/static/js/minimizing')); cb(); } function scriptsDetail(cb) { gulp.src([ 'app/static/js/goodPage/zoom_effect.js', 'app/static/js/goodPage/good_modalSlider.js', 'app/static/js/goodPage/good-anchorToSpecs.js', 'app/static/js/goodPage/longSlider.js', 'app/static/js/goodPage/good_Modal_show.js', 'app/static/js/goodPage/good_showAswForm.js', 'app/static/js/goodPage/good_leftsideSlider.js', 'app/static/js/goodPage/jsHelpers/hide_sidebar.js' ]) .pipe(concat('detail.min.js')) .pipe(plumber()) .pipe(babel({ presets: ['@babel/preset-env'] })) .pipe(uglify()) .pipe(gulp.dest('app/static/js/minimizing')); cb(); } exports.default = parallel( scripts, scriptsDetail ); в консоле пишется это Код C:ShopMakingWorkDjango_shop>gulp [11:19:05] Using gulpfile C:ShopMakingWorkDjango_shopgulpfile.js [11:19:05] Starting 'default'... [11:19:05] Starting 'scripts'... [11:19:05] Starting 'scriptsDetail'... [11:19:05] Finished 'scripts' after 16 ms [11:19:05] Finished 'scriptsDetail' after 21 ms [11:19:05] Finished 'default' after 24 ms [11:19:07] Plumber found unhandled error: SyntaxError in plugin "gulp-babel" Message: C:ShopMakingWorkDjango_shopappstaticjsgoodPagedetail.min.js: Support for the experimental syntax 'classProperties' isn't currently enabled (227:11): 225 | 226 | class SliderBarJs { > 227 | truly = true; | ^ 228 | constructor() { 229 | this.wr = document.getElementById(`sdBar-wrapper`); 230 | this.content = document.getElementById(`sdBar-content`); Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation. If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing. Да, и что значить вызов функции cb(); в каждой функции в gulpfile.js?
1 |
web_coder2 748 / 354 / 99 Регистрация: 04.10.2018 Сообщений: 542 |
||||
22.01.2021, 12:45 |
79 |
|||
надо как то эту штуку к gulp прикрутить или не использовать в класса свойства Добавлено через 4 минуты
Добавлено через 6 минут
Да, и что значить вызов функции cb(); в каждой функции в gulpfile.js? https://gulpjs.com/docs/en/get… ompletion/ Добавлено через 24 секунды
Заработало! Поздравляю
1 |
50 / 14 / 3 Регистрация: 15.02.2019 Сообщений: 514 |
|
22.01.2021, 12:52 [ТС] |
80 |
А эти штукенции что делают? Код presets: ['@babel/preset-env'], plugins: ["@babel/plugin-proposal-class-properties"]
0 |
IT_Exp Эксперт 87844 / 49110 / 22898 Регистрация: 17.06.2006 Сообщений: 92,604 |
22.01.2021, 12:52 |
80 |
When you’re running Gulp, you might see an error that says something like “cannot find module gulp-sass”.
This error message means that Gulp is trying to run a function from the gulp-sass package, but it can’t locate it.
If you’re getting this annoying error, here are a few fixes that you can use to get rid of it.
Check your node_modules folder
When you install npm packages, npm will create a node_modules
folder in your project root. It will also add packages you’ve installed to your package.json
and package-lock.json
files.
You can confirm that a package has been installed by making sure it’s listed in your package
and package-lock.json
files. And double-check your node_modules
folder to make sure the package is in a subfolder there.
Lastly, make sure you are running your website or web app from the project root folder, and that the root folder contains the node_modules
folder as a direct subfolder. If the node_modules
folder isn’t in that location, it may cause this error.
Install the gulp-sass module manually
If you don’t see the gulp-sass
package in your node_modules
folder, or are still having issues, you can try reinstalling the package.
First, open your package.json
and package-lock.json
files and remove any references to gulp-sass
and node-sass
that you see. This will make sure that you will reinstall the most up-to-date version of the packages.
Then, run npm install gulp-sass
or npm install gulp-sass --save-dev
to install and save in package.json
file. Adding the --save-dev
flag will add packages to the devDependencies
section of your package.json
file.
If you don’t add the flag it will get added to the dependencies
section of the file. Especially if you’re just working locally, it doesn’t matter a ton which section you use, so follow your own preferences on this.
Note that this will install the package locally in your project folder, and the package will be accessible only from that project. You can also install packages globally on your computer, so that they are accessible from any other directory.
You can do this by adding the global (-g
) flag to the install
command, like this: npm install -g gulp-sass
.
However I usually install packages local to the project. I do install the gulp-cli
globally, but everything else I just keep local.
Delete and reinstall all npm packages
If just removing and reinstalling just the gulp-sass
package doesn’t work, you can try deleting and reinstalling all your npm packages.
First, make sure that all the packages you need in your project exist in your package.json
file. Also make sure that gulp-sass
exists in your package.json
file.
Then, delete your node_modules
folder. You can do this by deleting from your file explorer, or running rm node_modules
in the command line. If you encounter errors or difficulties deleting the folder, you can try installing an npm package called rimraf that helps with deleting.
I install rimraf globally on my computer so I can run it from any directory. You can install rimraf globally by running npm install -g rimraf
. Then you can attempt to delete the folder by running rimraf node_modules
from the project root command line.
If you still have issues or get an error like node_modules@types is not accessible
you may need to first close VS Code or whichever code editor you are using. Then try deleting the folder again.
Once you have successfully deleted the node_modules
folder, run npm install
from your project root to install all the packages you have listed.
Want to learn how to build a website?
I’m making a course that will teach you how to build a real-world responsive website from scratch!
Learn more
Linux Ubuntu 18:04 user here.
I tried all the solutions on this board to date. Even though I read above in the accepted answer that «From later versions, there is no need to manually install gulp-util.», it was the thing that worked for me. (…maybe bc I’m on Ubuntu? I don’t know. )
To recap, I kept getting the «cannot find module ‘gulp-util’» error when just checking to see if gulp was installed by running:
gulp --version
…again, the ‘gulp-util’ error kept appearing…
So, I followed the npm install [package name] advice listed above, but ended up getting several other packages that needed to be installed as well. And one had a issue of already existing, and i wasn’t sure how to replace it. …I will put all the packages/install commands that I had to use here, just as reference in case someone else experiences this problem:
sudo npm install -g gulp-util
(then I got an error for ‘pretty-hrtime’ so I added that, and then the others as Error: Cannot find module ___ kept popping up after each gulp —version check. …so I just kept installing each one.)
sudo npm install -g pretty-hrtime
sudo npm install -g chalk
sudo npm install -g semver --force
(without —force, on my system I got an error: «EEXIST: file already exists, symlink». —force is not recommended, but idk any other way. )
sudo npm install -g archy
sudo npm install -g liftoff
sudo npm install -g tildify
sudo npm install -g interpret
sudo npm install -g v8flags
sudo npm install -g minimist
And now gulp —version is finally showing:
CLI version 3.9.1
Local version 3.9.1