Этот проект был построен на windows машине, и сейчас я пытаюсь запустить его на Ма c. У меня такое ощущение, что ОС неправильно интерпретирует '/' или '\', но это также может быть связано с некоторыми проблемами npm install, которые можно найти ниже. Сбой сценария: 'npm run build: css'.
{
"name": "SCC",
"version": "1.0.0",
"description": "A tool",
"main": "index.js",
"scripts": {
"watch:sass": "node-sass sass/main.scss resources/css/style.css -w",
"devserver": "live-server",
"start": "npm-run-all --parallel devserver watch:sass",
"compile:sass": "node-sass sass/main.scss resources/css/style.comp.css",
"prefix:css": "postcss --use autoprefixer -b \"last 10 versions\" resources/css/style.comp.css -o resources/css/style.prefix.css",
"compress:css": "node-sass resources/css/style.prefix.css resources/css/style.css --output-style compressed",
"build:css": "npm-run-all compile:sass prefix:css compress:css"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SCC/SC.git"
},
"author": "SC",
"license": "ISC",
"bugs": {
"url": "https://github.com/SC/SCC/issues"
},
"homepage": "https://github.com/SC/SCC#readme",
"dependencies": {},
"devDependencies": {
"autoprefixer": "^9.4.5",
"concat": "^1.0.3",
"live-server": "^1.2.1",
"node-sass": "^4.11.0",
"npm-run-all": "^4.1.5",
"postcss-cli": "^6.1.1"
}
}
LOGS:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'watch:sass' ]
2 info using npm@6.13.7
3 info using node@v13.11.0
4 verbose run-script [ 'prewatch:sass', 'watch:sass', 'postwatch:sass' ]
5 info lifecycle scc@1.0.0~prewatch:sass: scc@1.0.0
6 info lifecycle scc@1.0.0~watch:sass: scc@1.0.0
7 verbose lifecycle scc@1.0.0~watch:sass: unsafe-perm in lifecycle true
8 verbose lifecycle scc@1.0.0~watch:sass: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/sc/Projects/SCC/node_modules/.bin:/usr/local/bin:/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home:/Users/sc/Library/Tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home:/Users/sc/Library/Tools
9 verbose lifecycle scc@1.0.0~watch:sass: CWD: /Users/sc/Projects/SCC
10 silly lifecycle scc@1.0.0~watch:sass: Args: [ '-c', 'node-sass sass/main.scss resources/css/style.css -w' ]
11 info lifecycle scc@1.0.0~watch:sass: Failed to exec watch:sass script
12 verbose stack Error: scc@1.0.0 watch:sass: `node-sass sass/main.scss resources/css/style.css -w`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1026:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
13 verbose pkgid scc@1.0.0
14 verbose cwd /Users/sc/Projects/SCC
15 verbose Darwin 19.4.0
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch:sass"
17 verbose node v13.11.0
18 verbose npm v6.13.7
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error scc@1.0.0 watch:sass: `node-sass sass/main.scss resources/css/style.css -w`
23 error spawn ENOENT
24 error Failed at the scc@1.0.0 watch:sass script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
NPM INSTALL ПРОБЛЕМА
> node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/sc/Projects/SCC/node_modules/fsevents
gyp ERR! node -v v13.11.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
РЕШЕНИЕ:
Мне нужно было установить соответствующие инструменты командной строки Xcode, и это в конечном итоге позволило мне установить пакет node-gyp. Затем я удаляю папку node-modules и файл блокировки пакета из моего проекта, вызываю npm install и мои сценарии работают.