Error executing NPM Scripts

Hello,

Today to installed an update to Framework7 CLI and now I am not able to create a new project. Below is the error that I get:

× Error executing NPM Scripts
Cannot copy `'./node_modules/framework7-icons/fonts/*.*'`: the file doesn't exist
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `cpy './node_modules/framework7-icons/fonts/*.*' './src/fonts/'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ref HandMan\AppData\Roaming\npm-cache\_logs\2019-12-06T14_49_17_555Z-debug.log

Here are the options that I used:

D:\PhoneGap\test6>framework7 create
√ All good, you have latest framework7-cli version.
? What type of the app are you targeting? Cordova app (targets native iOS and An
droid apps, or native desktop app with Electron)
? App (project) name: Test6
? App package (Bundle ID): io.framework.test6
? Target Cordova platform: Android, Electron (native desktop app)
? What type of framework do you prefer? Framework7 Core
? Choose starter template: Single View
? Should we setup project with bundler? Webpack (recommended)
? Do you want to setup CSS Pre-Processor No, i am good with CSS
? Do you want to specify custom theme color? No, use default color theme
? Do you want to include Framework7 Icons and Material Icons icon fonts? Yes, in
clude icon fonts

Additional Information:

  • Running Windows 10 Pro
  • Node v12.13.0
  • npm 6.12.1
  • framework7-cli 3.0.6

I reinstalled node, npm, cordova, and f7 cli and still get the error.
Confirmed that “./node_modules/framework7-icons/fonts” exists under the project folder and has files in it.

Log dump:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'postinstall'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'postinstall' ]
5 info lifecycle [email protected]~postinstall: [email protected]
6 verbose lifecycle [email protected]~postinstall: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]~postinstall: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\PhoneGap\test6\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Microsoft MPI\Bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\WINDOWS\System32\OpenSSH\;C:\AndroidSdk\tools;C:\AndroidSdk\platform-tools;C:\Gradle\gradle-5.6.2\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\nodejs\;C:\Users\Ref HandMan\AppData\Local\Microsoft\WindowsApps;C:\Users\Ref HandMan\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Ref HandMan\AppData\Roaming\npm
8 verbose lifecycle [email protected]~postinstall: CWD: D:\PhoneGap\test6
9 silly lifecycle [email protected]~postinstall: Args: [
9 silly lifecycle   '/d /s /c',
9 silly lifecycle   "cpy './node_modules/framework7-icons/fonts/*.*' './src/fonts/'"
9 silly lifecycle ]
10 silly lifecycle [email protected]~postinstall: Returned: code: 1  signal: null
11 info lifecycle [email protected]~postinstall: Failed to exec postinstall script
12 verbose stack Error: [email protected] postinstall: `cpy './node_modules/framework7-icons/fonts/*.*' './src/fonts/'`
12 verbose stack Exit status 1
12 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
12 verbose stack     at EventEmitter.emit (events.js:210:5)
12 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
12 verbose stack     at ChildProcess.emit (events.js:210:5)
12 verbose stack     at maybeClose (internal/child_process.js:1021:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
13 verbose pkgid [email protected]
14 verbose cwd D:\PhoneGap\test6
15 verbose Windows_NT 10.0.18362
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "postinstall"
17 verbose node v12.13.1
18 verbose npm  v6.12.1
19 error code ELIFECYCLE
20 error errno 1
21 error [email protected] postinstall: `cpy './node_modules/framework7-icons/fonts/*.*' './src/fonts/'`
21 error Exit status 1
22 error Failed at the [email protected] postinstall script.
22 error This is probably not a problem with npm. There is likely additional logging output above.
23 verbose exit [ 1, true ]

Also, I try to do this on a fresh install of Windows 10 and got the same error so I know that the issue isn’t anything on my end.

Could someone look into this?

Ok, I was able to work around this issue by saying “No” to question include Framework7 Icons. Now, however, this isn’t a good work around because the apps don’t render correctly since I need to use them.

Any assistance would be appreciated.

Looks like it can’t execute command cpy './node_modules/framework7-icons/fonts/*.*' './src/fonts/' to copy f7 icons fonts to your project folder. This can be because of some permissions issues on your system/folders. You can just copy it manually then

@nolimits4web I didn’t have this issue until I got the update the other day. Also, I ran this under the Command Prompt run as Administrator and confirmed that my user has full rights to the folder.

I was able to locate the offending line in the file generate-package-json.js on line 110. I made the change locally on my machine and it fixed the issue. I recommend that you make a similar change to the master branch in a future update.

I replaced

postInstall.push(`cpy './node_modules/framework7-icons/fonts/*.*' './${bundler ? 'src' : 'www'}/fonts/'`);

with

postInstall.push(`cpy "./node_modules/framework7-icons/fonts/*.*" "./${bundler ? 'src' : 'www'}/fonts/"`);

Source file:
https://github.com/framework7io/framework7-cli/blob/master/create-app/utils/generate-package-json.js

I faced same problem in Windows 10 Command Line.

The problem is when you creating project with Framework7-CLI it suddenly throws this exception and you cannot proceed.

P.S. With --ui you don’t see any errors, it just stops.

"postinstall": "cpy node_modules/framework7-icons/fonts/*.* ./src/fonts/"

Yes, looks like it is an issue with cpy dependency, will release CLI update with this fix

2 Likes

@nolimits4web thanks!

Confirmed that this issue is fixed in the latest version of CLI

1 Like