nanogen
nanogen copied to clipboard
Nanogen -w doesn't work on windows
I add a "watchmode": "nanogen -w" script to package.lock
When I write npm run watchmode in windows console it gives me next error:
Error: EPERM: operation not permitted, readlink 'D:\test\public\jsons' at Object.fs.readlinkSync (fs.js:967:18) at checkDest (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:184:23) at checkPaths (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:208:24) at copyDirItem (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:133:24) at fs.readdirSync.forEach.item (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:127:39) at Array.forEach (
) at copyDir (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:127:23) at mayCopyDir (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:117:10) at onDir (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:108:12) at getStats (D:\test\node_modules\fs-extra\lib\copy-sync\copy-sync.js:44:32)
I have /jsons folder in /assets. Normally with nanogen it's added to /public
But /public directory is empty at all. What is the reason?
UPD2 found a solution from this user: run command prompt in administrator mode. nanogen -w starts a server but after any changes it crashes with the same error.
Hi! I can confirm the issue and will investigate.
Thanks for reporting!
Any progress on this one? Thanks in advance!
+1
Hi,
(Win7)
I made some edits to the files (this is bad practice, but I needed it): /lib/modules/build.js /lib/modules/serve.js /lib/utils/server.js
The problem with "operation not permitted" in /lib/modules/build.js -> fse.copySync(). Didn't dig deep ... Just used: await fse.copy()
const build = async (options = {}) => {
...
// copy assets folder
if (fse.existsSync(${srcPath}/assets)) {
await fse.copy(${srcPath}/assets, outputPath);
}
...
Changes in /lib/modules/serve.js:
... //const debounce = require('lodash.debounce'); // ? ...
/**
- Serve the site in watch mode */ const serve = async (options, flags) => { ... chokidar.watch(srcPath, { ignoreInitial: true }).on( 'all', //debounce( async () => { await build(options); log.info('Waiting for changes...'); } //, 500) ); }; ...
Changes in /lib/utils/server.js:
Added to parameters: noCssInject: true. Без этого параметра перезагрузка работала через раз.
Without this parameter, the restart worked terribly.
It is better not to use it in your project. This is a one-time solution. Perhaps it will help solve the problem.
Thanks, @a3con! It will surely help solving the issue.