pnp / sp-dev-fx-webparts

SharePoint Framework web part, Teams tab, personal app, app page samples
http://aka.ms/spfx-webparts
MIT License
2.04k stars 3.85k forks source link

Gulp Build not working on react-calendar #5209

Closed SharePointPro closed 1 month ago

SharePointPro commented 1 month ago

Disclaimer

Yes

Sample

https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-calendar

Contributor(s)

Hugo Bernier Peter Paul Kirschner

What happened?

When using the recommended node version 12.13.0 (64 bit), and running NPM install from a clean clone, the error

code: 'MODULE_NOT_FOUND',

occurs when running gulp build

Full Error: `PS C:\sppro2\Libraries\react-calendar> gulp build --ship Error: Cannot find module 'node:process' Require stack:

Steps to reproduce

  1. Clone sp-dev-fx-webparts
  2. Have Node 12.13.0 installed
  3. Run npm install in react-calendar folder
  4. run gulp build

Expected behavior

The app to build correctl;y

Target SharePoint environment

SharePoint Online

Developer environment

Windows

Browsers

What version of Node.js is currently installed on your workstation?

12.13.0

What version of Node.js is required by the sample?

12.13.0

Paste the results of SPFx doctor

C:\Users\tipha\AppData\Roaming\nvm\v12.13.0\node_modules\@pnp\cli-microsoft365\dist\index.js:2 import { cli } from './cli/cli.js'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at Module._compile (internal/modules/cjs/loader.js:892:18) at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10) at Module.load (internal/modules/cjs/loader.js:812:32) at Function.Module._load (internal/modules/cjs/loader.js:724:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10) at internal/main/run_main_module.js:17:11

Additional environment details

I have also tried on node 13, 14, 10,

github-actions[bot] commented 1 month ago

Wrong or missing contributor @mentions

Thank you for your submission, but you appear to have forgotten to @mention the sample author(s).

To help increase your chances of getting assistance from the original authors of the sample, you should make sure to @mention the actual authors (and not the repository maintainers).

Make sure to include the @ character before the GitHub username so that the author(s) get notified; using the person's name is not going to work.

Please note that the sample authors will not get notified about this issue unless you update this issue accordingly.

You can find the author(s) of each sample in the sample's README.md, under Solution.

We'll automatically close this issue in 7 days unless you update the issue.

For more information on how to create a good issue, refer to our wiki for more information: How to Create Good Issues

github-actions[bot] commented 1 month ago

Please note that this issue will be closed within 24 hours because it has been flagged as having invalid authors. Read the guidance and @mention the authors so they can respond to you.

github-actions[bot] commented 1 month ago

Closing this issue due to lack of response. Feel free to open a new issue, but make sure to follow the guidance on how to create good issues and @mention the authors so they can respond to you.

TracyGH commented 1 week ago

@SharePointPro - I'm having the exact same issue you've described here with the react-calendar sample. Were you able to resolve it? And if so, how? Thanks! 😊

SharePointPro commented 1 week ago

No, I did't find a solution.

hugonallet commented 1 week ago

Hi @SharePointPro and @TracyGH, I have the same issue here because of another module. I'm still trying to find a way... I'll let you know if I ever achieve a miracle

hugonallet commented 1 week ago

UPDATE To solve this specific issue I founded this stackoverflow page : Here

That's mean you need to change the version of node.js. again. I use this one : nvm use 14.18.0 After this the gulp build can be launch "correctly", but I still have an error with node comptability lol.

gulp build Build target: DEBUG [01:03:18] Using gulpfile C:\Dev\sp-dev-fx-webparts\samples\react-calendar\gulpfile.js [01:03:18] Starting 'build'... [01:03:18] Starting gulp [01:03:18] Starting subtask 'pre-copy'... [01:03:18] Finished subtask 'pre-copy' after 34 ms [01:03:18] Starting subtask 'copy-static-assets'... [01:03:18] Starting subtask 'sass'... [01:03:19] Finished subtask 'sass' after 1.27 s [01:03:19] Starting subtask 'lint'... [01:03:19] [lint] tslint version: 5.20.1 [01:03:19] Starting subtask 'tsc'... [01:03:19] [tsc] typescript version: 3.9.10 [01:03:19] Finished subtask 'copy-static-assets' after 1.5 s [01:03:38] Error - [tsc] node_modules/@types/react-big-calendar/node_modules/@types/react/ts5.0/index.d.ts(3347,50): error TS1110: Type expected. [01:03:38] Error - [tsc] node_modules/@types/react-big-calendar/node_modules/@types/react/ts5.0/index.d.ts(3348,51): error TS1110: Type expected. [01:03:38] Error - [tsc] node_modules/@types/react-big-calendar/node_modules/@types/react/ts5.0/index.d.ts(3349,48): error TS1110: Type expected. [01:03:38] Error - [tsc] node_modules/@types/react-big-calendar/node_modules/@types/react/ts5.0/index.d.ts(3349,91): error TS1005: '(' expected. [01:03:38] Error - 'tsc' sub task errored after 19 s exited with code 2 [01:03:38] 'build' errored after 20 s About to exit with code: 1 Process terminated before summary could be written, possible error in async code not continuing! Trying to exit with exit code 1