Npm ERR! Line breaks can't be quoted on Windows

Error installing NPM Dependencies

Hello,
I have installed framework CLI and tried to create a new app for the first time

Then, folowing the instructions executed framework7 create

After I chose starter template I got an error:

C:\Users\Microsoft\Documents\VS Code\testFr7>framework7 create
√ All good, you have latest framework7-cli version.
? What type of the app are you targeting? Simple web app
? App (project) name: Test
? 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 SCSS (SASS)
? 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, include icon fonts
√ Generating package.json
√ Creating required folders structure
× Error installing NPM Dependencies
npm ERR! Line breaks can't be quoted on Windows

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Microsoft\AppData\Local\npm-cache\_logs\2020-12-06T13_29_37_005Z-debug.log

There is th log of the run:

0 verbose cli [
0 verbose cli ‘C:\Program Files\nodejs\node.exe’,
0 verbose cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’,
0 verbose cli ‘install’,
0 verbose cli ‘[email protected]’,
0 verbose cli ‘[email protected]’,
0 verbose cli ‘template7’,
0 verbose cli ‘framework7-icons’,
0 verbose cli ‘–save’
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:C:\Users\Microsoft\Documents\VS Code\testFr7.npmrc Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:C:\Users\Microsoft.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\Microsoft\AppData\Roaming\npm\etc\npmrc Completed in 1ms
13 timing config:load:global Completed in 1ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 6ms
19 verbose npm-session 39e04688aa6d9e9f
20 timing npm:load Completed in 12ms
21 timing arborist:ctor Completed in 0ms
22 timing arborist:ctor Completed in 0ms
23 timing idealTree:init Completed in 13ms
24 timing idealTree:userRequests Completed in 4ms
25 silly idealTree buildDeps
26 silly fetch manifest [email protected]
27 http fetch GET 304 https://registry.npmjs.org/framework7 105ms (from cache)
28 silly fetch manifest [email protected]
29 http fetch GET 304 https://registry.npmjs.org/dom7 66ms (from cache)
30 silly fetch manifest [email protected]*
31 http fetch GET 304 https://registry.npmjs.org/template7 22ms (from cache)
32 silly fetch manifest [email protected]*
33 http fetch GET 304 https://registry.npmjs.org/framework7-icons 30ms (from cache)
34 silly placeDep ROOT [email protected]5 OK for: [email protected] want: 2
35 silly placeDep ROOT [email protected] OK for: [email protected] want: 5
36 silly placeDep ROOT [email protected] OK for: [email protected] want: *
37 silly placeDep ROOT [email protected] OK for: [email protected] want: *
38 silly fetch manifest [email protected]^2.0.0
39 silly fetch manifest [email protected]^6.1.0
40 http fetch GET 304 _https://registry.npmjs.org/ssr-window 33ms (from cache)
41 http fetch GET 304 _https://registry.npmjs.org/path-to-regexp 33ms (from cache)
42 timing idealTree:#root Completed in 271ms
43 silly placeDep ROOT [email protected] OK for: [email protected] want: ^2.0.0
44 timing idealTree:node_modules/dom7 Completed in 1ms
45 silly placeDep ROOT [email protected] OK for: [email protected] want: ^6.1.0
46 timing idealTree:node_modules/framework7 Completed in 2ms
47 timing idealTree:node_modules/framework7-icons Completed in 0ms
48 timing idealTree:node_modules/path-to-regexp Completed in 0ms
49 timing idealTree:node_modules/ssr-window Completed in 0ms
50 timing idealTree:node_modules/template7 Completed in 0ms
51 timing idealTree:buildDeps Completed in 275ms
52 timing idealTree:fixDepFlags Completed in 1ms
53 timing idealTree Completed in 293ms
54 timing reify:loadTrees Completed in 293ms
55 timing reify:diffTrees Completed in 1ms
56 silly reify moves {}
57 timing reify:retireShallow Completed in 0ms
58 timing reify:createSparse Completed in 2ms
59 timing reify:loadBundles Completed in 0ms
60 timing reifyNode:node_modules/path-to-regexp Completed in 152ms
61 timing reifyNode:node_modules/ssr-window Completed in 157ms
62 timing reifyNode:node_modules/template7 Completed in 164ms
63 timing reifyNode:node_modules/dom7 Completed in 169ms
64 timing reifyNode:node_modules/framework7-icons Completed in 668ms
65 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 838ms
66 timing auditReport:getReport Completed in 840ms
67 timing auditReport:init Completed in 0ms
68 timing reify:audit Completed in 840ms
69 timing reifyNode:node_modules/framework7 Completed in 959ms
70 timing reify:unpack Completed in 960ms
71 timing reify:unretire Completed in 0ms
72 timing build:queue Completed in 1ms
73 info run [email protected] postinstall node_modules/framework7 echo "e[35me[1mLove Framework7? Support project by donating or pledging on patreon:e[22me[39m
73 info run > e[32mhttps://patreon.com/vladimirkharlampidie[0m
73 info run "
74 info run [email protected] postinstall { code: undefined, signal: undefined }
75 timing reify:rollback:createSparse Completed in 0ms
76 timing reify:rollback:retireShallow Completed in 0ms
77 timing command:install Completed in 1265ms
78 verbose stack Error: Line breaks can’t be quoted on Windows
78 verbose stack at quoteForCmd (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:41:11)
78 verbose stack at Formatter.quote (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:256:12)
78 verbose stack at quoteForShell (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:743:34)
78 verbose stack at C:\Program Files\nodejs\node_modules\npm\[email protected]\run-script\lib\make-spawn-args.js:13:90
78 verbose stack at Array.map ()
78 verbose stack at escapeCmd (C:\Program Files\nodejs\node_modules\npm\[email protected]\run-script\lib\make-spawn-args.js:13:75)
78 verbose stack at makeSpawnArgs (C:\Program Files\nodejs\node_modules\npm\[email protected]\run-script\lib\make-spawn-args.js:37:43)
78 verbose stack at runScriptPkg (C:\Program Files\nodejs\node_modules\npm\[email protected]\run-script\lib\run-script-pkg.js:54:29)
78 verbose stack at runScript (C:\Program Files\nodejs\node_modules\npm\[email protected]\run-script\lib\run-script.js:9:16)
78 verbose stack at Array. (C:\Program Files\nodejs\node_modules\npm\[email protected]\arborist\lib\arborist\rebuild.js:264:17)
79 verbose cwd C:\Users\Microsoft\Documents\VS Code\testFr7
80 verbose Windows_NT 10.0.18363
81 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install” “[email protected]” “[email protected]” “template7” “framework7-icons” “–save”
82 verbose node v15.3.0
83 verbose npm v7.0.14
84 error Line breaks can’t be quoted on Windows
85 verbose exit 1

What should I do to solve the error?

Best Regards.

Stas

Hi,

I did try it today in VSCode for Windows with latest versions of node and npm installed and also failed to create an app with framework7 CLI with the same error.

I have been searching the solution for 5 days and nothing have found…

For me only worked the manual installation and further creating an app by hand.

Afte hours going through this erro i finally found a solution by trying the following steps:

  1. go to the script mentioned in the error (‘C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js’)
  2. Look for the line: throw new Error(“Line breaks can’t be quoted on Windows”) in the function quoteForCmd and comment it.
  3. type the following code: text.replace(/[\n\r]/,’ ') bellow the commented line;
  4. Save the file.
  5. Run the npm script again.

Pdt: once successfully done, do not forget to undo the changes in the mentioned js file.

¡Hope this works for u!

Hi, thank you for help!

Should it look after following steps like that?
if (/[\n\r]/.test(text)) {
// throw new Error(“Line breaks can’t be quoted on Windows”);
text.replace(/[\n\r]/,’ ')
}
In the text.replace(/[\n\r]/,’ ') did you mean in the second parametr single quotes?
If yes - I still have the same error
If no - I have the next error:
C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:42
text.replace(/[\n\r]/, ’ ');

SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1024:16)
    at Module._compile (node:internal/modules/cjs/loader:1072:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:6:78)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163
      throw new Error('call config.load() before reading values')
      ^

Error: call config.load() before reading values
    at Config.get (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163:13)
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:177:32)
    at process.emit (node:events:376:20)
    at process._fatalException (node:internal/process/execution:163:25)
C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:42
                text.replace(/[\n\r]/, ’ ');


SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1024:16)
    at Module._compile (node:internal/modules/cjs/loader:1072:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:6:78)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163
      throw new Error('call config.load() before reading values')
      ^

Error: call config.load() before reading values
    at Config.get (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163:13)
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:177:32)
    at process.emit (node:events:376:20)
    at process._fatalException (node:internal/process/execution:163:25)

Did you get it to work out for you? I have been getting the same issue and nothing seems to work.

Unfortunately, it did not work out for me also.

@TwiZzz @JMM @Esteban_1206 same here.
cannot create project from framework7-cli

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'install',
0 verbose cli   'framework7',
0 verbose cli   'dom7',
0 verbose cli   'swiper',
0 verbose cli   'skeleton-elements',
0 verbose cli   'framework7-icons',
0 verbose cli   '--save'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:E:\ANDROID\Waterworks\.npmrc Completed in 1ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\admin\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\admin\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 8ms
19 verbose npm-session 310bbaee2e622ff2
20 timing npm:load Completed in 16ms
21 timing arborist:ctor Completed in 0ms
22 timing arborist:ctor Completed in 0ms
23 timing idealTree:init Completed in 21ms
24 timing idealTree:userRequests Completed in 2ms
25 silly idealTree buildDeps
26 silly fetch manifest [email protected]*
27 http fetch GET 304 https://registry.npmjs.org/framework7 157ms (from cache)
28 silly fetch manifest [email protected]*
29 http fetch GET 304 https://registry.npmjs.org/dom7 102ms (from cache)
30 silly fetch manifest [email protected]*
31 http fetch GET 304 https://registry.npmjs.org/swiper 78ms (from cache)
32 silly fetch manifest [email protected]*
33 http fetch GET 304 https://registry.npmjs.org/skeleton-elements 81ms (from cache)
34 silly fetch manifest [email protected]*
35 http fetch GET 304 https://registry.npmjs.org/framework7-icons 87ms (from cache)
36 silly placeDep ROOT [email protected] OK for: [email protected] want: *
37 silly placeDep ROOT [email protected] OK for: [email protected] want: *
38 silly placeDep ROOT [email protected] OK for: [email protected] want: *
39 silly placeDep ROOT [email protected] OK for: [email protected] want: *
40 silly placeDep ROOT [email protected] OK for: [email protected] want: *
41 silly fetch manifest [email protected]^3.0.0-alpha.1
42 silly fetch manifest [email protected]^3.0.4
43 silly fetch manifest [email protected]^6.2.0
44 silly fetch manifest [email protected]^3.0.0
45 silly fetch manifest [email protected]^2.0.0
46 http fetch GET 304 https://registry.npmjs.org/path-to-regexp 201ms (from cache)
47 http fetch GET 304 https://registry.npmjs.org/ssr-window 211ms (from cache)
48 http fetch GET 304 https://registry.npmjs.org/tslib 203ms (from cache)
49 http fetch GET 304 https://registry.npmjs.org/htm 208ms (from cache)
50 http fetch GET 304 https://registry.npmjs.org/ssr-window 206ms (from cache)
51 timing idealTree:#root Completed in 759ms
52 silly placeDep ROOT [email protected] OK for: [email protected] want: ^3.0.0-alpha.1
53 timing idealTree:node_modules/dom7 Completed in 2ms
54 silly placeDep ROOT [email protected] OK for: [email protected] want: ^3.0.4
55 silly placeDep ROOT [email protected] OK for: [email protected] want: ^6.2.0
56 timing idealTree:node_modules/framework7 Completed in 4ms
57 timing idealTree:node_modules/framework7-icons Completed in 0ms
58 timing idealTree:node_modules/htm Completed in 0ms
59 timing idealTree:node_modules/path-to-regexp Completed in 0ms
60 timing idealTree:node_modules/skeleton-elements Completed in 0ms
61 timing idealTree:node_modules/ssr-window Completed in 0ms
62 silly placeDep ROOT [email protected] OK for: [email protected] want: ^2.0.0
63 timing idealTree:node_modules/swiper Completed in 1ms
64 timing idealTree:node_modules/tslib Completed in 0ms
65 timing idealTree:buildDeps Completed in 768ms
66 timing idealTree:fixDepFlags Completed in 1ms
67 timing idealTree Completed in 795ms
68 timing reify:loadTrees Completed in 795ms
69 timing reify:diffTrees Completed in 1ms
70 silly reify moves {}
71 timing reify:retireShallow Completed in 0ms
72 timing reify:createSparse Completed in 5ms
73 timing reify:loadBundles Completed in 0ms
74 timing reifyNode:node_modules/tslib Completed in 237ms
75 timing reifyNode:node_modules/ssr-window Completed in 244ms
76 timing reifyNode:node_modules/path-to-regexp Completed in 265ms
77 timing reifyNode:node_modules/dom7 Completed in 274ms
78 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 353ms
79 timing auditReport:getReport Completed in 355ms
80 timing auditReport:init Completed in 0ms
81 timing reify:audit Completed in 356ms
82 timing reifyNode:node_modules/htm Completed in 606ms
83 timing reifyNode:node_modules/skeleton-elements Completed in 914ms
84 timing reifyNode:node_modules/swiper Completed in 2055ms
85 timing reifyNode:node_modules/framework7-icons Completed in 2199ms
86 timing reifyNode:node_modules/framework7 Completed in 3413ms
87 timing reify:unpack Completed in 3415ms
88 timing reify:unretire Completed in 0ms
89 timing build:queue Completed in 3ms
90 info run [email protected] postinstall node_modules/framework7 echo "e[35me[1mLove Framework7? Support project by donating or pledging on patreon:e[22me[39m
90 info run  > e[32mhttps://patreon.com/vladimirkharlampidie[0m
90 info run "
91 info run [email protected] postinstall node_modules/swiper node postinstall.js
92 info run [email protected] postinstall { code: undefined, signal: undefined }
93 timing reify:rollback:createSparse Completed in 0ms
94 timing reify:rollback:retireShallow Completed in 0ms
95 timing command:install Completed in 4243ms
96 verbose stack Error: Line breaks can't be quoted on Windows
96 verbose stack     at quoteForCmd (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:41:11)
96 verbose stack     at Formatter.quote (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:256:12)
96 verbose stack     at quoteForShell (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js:743:34)
96 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:13:90
96 verbose stack     at Array.map (<anonymous>)
96 verbose stack     at escapeCmd (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:13:75)
96 verbose stack     at makeSpawnArgs (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:37:43)
96 verbose stack     at runScriptPkg (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:54:29)
96 verbose stack     at runScript (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:9:16)
96 verbose stack     at Array.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\rebuild.js:264:17)
97 verbose cwd E:\ANDROID\Waterworks
98 verbose Windows_NT 10.0.15063
99 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "framework7" "dom7" "swiper" "skeleton-elements" "framework7-icons" "--save"
100 verbose node v15.5.1
101 verbose npm  v7.3.0
102 error Line breaks can't be quoted on Windows
103 verbose exit 1

:wave: community,

solution from @Esteban_1206 didn’t work.

:orange_circle: had installed node via chocolatey (in my system)
:orange_circle: completely uninstalled node via chocolatey
:orange_circle: then installed node from there official site
:orange_circle: now, here framework7 project running well